💄 add page comment counter click event.
This commit is contained in:
parent
a4f496b796
commit
d44d4c2a79
@ -113,3 +113,8 @@
|
||||
flex-basis: 100%;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
#comments-count {
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid $link-decoration-color;
|
||||
}
|
||||
|
@ -24,6 +24,14 @@ NexT.boot.registerEvents = function() {
|
||||
// Register comment's components
|
||||
NexT.plugins.register();
|
||||
|
||||
// Register comment counter click event
|
||||
const commentCnt = document.querySelector('#comments-count');
|
||||
if (commentCnt && NexT.CONFIG.page.isPage) {
|
||||
commentCnt.addEventListener('click', event => {
|
||||
NexT.utils.slidScrollBarAnime('comments');
|
||||
});
|
||||
}
|
||||
|
||||
// Mobile top menu bar.
|
||||
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => {
|
||||
event.currentTarget.classList.toggle('toggle-close');
|
||||
|
@ -59,11 +59,13 @@ NexT.utils = {
|
||||
},
|
||||
|
||||
slidScrollBarAnime: function (targetId, easing = 'linear', duration = 500) {
|
||||
const targetObj = document.getElementById(targetId);
|
||||
|
||||
window.anime({
|
||||
targets: document.scrollingElement,
|
||||
duration: duration,
|
||||
easing: easing,
|
||||
scrollTop: targetId == '' ? 0 : document.getElementById(targetId).getBoundingClientRect().top + window.scrollY
|
||||
scrollTop: targetId == '' || !targetObj ? 0 : targetObj.getBoundingClientRect().top + window.scrollY
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user