💄 Add tool button click events make it more silky.
This commit is contained in:
@@ -10,6 +10,7 @@ NexT.boot.registerEvents = function() {
|
||||
|
||||
NexT.utils.registerScrollPercent();
|
||||
// NexT.utils.registerCanIUseTag();
|
||||
NexT.utils.registerToolButtons();
|
||||
|
||||
// Mobile top menu bar.
|
||||
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => {
|
||||
|
||||
@@ -23,6 +23,28 @@ HTMLElement.prototype.wrap = function(wrapper) {
|
||||
|
||||
NexT.utils = {
|
||||
|
||||
registerToolButtons: function() {
|
||||
const comms_offset = document.getElementById('comments').getBoundingClientRect().top + window.scrollY;
|
||||
document.getElementById('goto-comments').addEventListener('click', () => {
|
||||
window.anime({
|
||||
targets : document.scrollingElement,
|
||||
duration : 500,
|
||||
easing : 'linear',
|
||||
scrollTop: comms_offset
|
||||
});
|
||||
});
|
||||
|
||||
const gt_offset = document.getElementById('google_translate_element').getBoundingClientRect().top + window.scrollY;
|
||||
document.getElementById('goto-gt').addEventListener('click', () => {
|
||||
window.anime({
|
||||
targets : document.scrollingElement,
|
||||
duration : 500,
|
||||
easing : 'linear',
|
||||
scrollTop: gt_offset
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
regSwitchThemeBtn: function() {
|
||||
const switchThemeBtn = document.getElementById('switch-theme');
|
||||
if (!switchThemeBtn) return;
|
||||
|
||||
Reference in New Issue
Block a user