fix: comment counter issue & no document scroll listening when no sidebar

This commit is contained in:
ppoffice 2016-04-23 14:13:48 +08:00
parent b317924366
commit bcabdd87dd
2 changed files with 18 additions and 16 deletions

View File

@ -1,9 +1,9 @@
<% if (post.comments) { %>
<% if (theme.comment.disqus) { %>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link disqus-comment-count" data-disqus-url="<%= url_for(post.path) %>"><%= __('article.comments') %></a>
<a href="<%- post.permalink %>#comments" class="article-comment-link disqus-comment-count" data-disqus-url="<%= post.permalink %>"><%= __('article.comments') %></a>
<% } else if (theme.comment.duoshuo) { %>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link ds-thread-count" data-thread-key="<%= post.path %>"><%= __('article.comments') %></a>
<a href="<%- post.permalink %>#comments" class="article-comment-link ds-thread-count" data-thread-key="<%= post.permalink %>"><%= __('article.comments') %></a>
<% } else if (theme.comment.youyan) { %>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link"><%= __('article.comments') %></a>
<a href="<%- post.permalink %>#comments" class="article-comment-link"><%= __('article.comments') %></a>
<% } %>
<% } %>

View File

@ -33,20 +33,22 @@
});
// To Top
$(document).on('scroll', function () {
if ($(document).width() >= 800) {
if(($(this).scrollTop() > toTop) && ($(this).scrollTop() > 0)) {
$('#toTop').fadeIn();
$('#toTop').css('left', $('#sidebar').offset().left);
if ($('#sidebar').length) {
$(document).on('scroll', function () {
if ($(document).width() >= 800) {
if(($(this).scrollTop() > toTop) && ($(this).scrollTop() > 0)) {
$('#toTop').fadeIn();
$('#toTop').css('left', $('#sidebar').offset().left);
} else {
$('#toTop').fadeOut();
}
} else {
$('#toTop').fadeOut();
$('#toTop').fadeIn();
$('#toTop').css('right', 20);
}
} else {
$('#toTop').fadeIn();
$('#toTop').css('right', 20);
}
}).on('click', '#toTop', function () {
$('body, html').animate({ scrollTop: 0 }, 600);
});
}).on('click', '#toTop', function () {
$('body, html').animate({ scrollTop: 0 }, 600);
});
}
})(jQuery);