fix: comment counter issue & no document scroll listening when no sidebar
This commit is contained in:
parent
b317924366
commit
bcabdd87dd
|
@ -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>
|
||||
<% } %>
|
||||
<% } %>
|
|
@ -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);
|
Loading…
Reference in New Issue