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 (post.comments) { %>
|
||||||
<% if (theme.comment.disqus) { %>
|
<% 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) { %>
|
<% } 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) { %>
|
<% } 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
|
// To Top
|
||||||
$(document).on('scroll', function () {
|
if ($('#sidebar').length) {
|
||||||
if ($(document).width() >= 800) {
|
$(document).on('scroll', function () {
|
||||||
if(($(this).scrollTop() > toTop) && ($(this).scrollTop() > 0)) {
|
if ($(document).width() >= 800) {
|
||||||
$('#toTop').fadeIn();
|
if(($(this).scrollTop() > toTop) && ($(this).scrollTop() > 0)) {
|
||||||
$('#toTop').css('left', $('#sidebar').offset().left);
|
$('#toTop').fadeIn();
|
||||||
|
$('#toTop').css('left', $('#sidebar').offset().left);
|
||||||
|
} else {
|
||||||
|
$('#toTop').fadeOut();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#toTop').fadeOut();
|
$('#toTop').fadeIn();
|
||||||
|
$('#toTop').css('right', 20);
|
||||||
}
|
}
|
||||||
} else {
|
}).on('click', '#toTop', function () {
|
||||||
$('#toTop').fadeIn();
|
$('body, html').animate({ scrollTop: 0 }, 600);
|
||||||
$('#toTop').css('right', 20);
|
});
|
||||||
}
|
}
|
||||||
}).on('click', '#toTop', function () {
|
|
||||||
$('body, html').animate({ scrollTop: 0 }, 600);
|
|
||||||
});
|
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
Loading…
Reference in New Issue