PATH:
home
/
lab2454c
/
fcxpro.com
/
wp-content
/
plugins
/
webon-core
/
inc
/
smooth-scroll
/
assets
/
js
/
parts
(function ($) { "use strict"; $(document).ready(function () { setTimeout(function () { qodefSmoothScroll.init(); }, 100); }); var qodefSmoothScroll = { init: function () { var smoothScrollEnabled = qodef.body.hasClass('qodef-scrolling-smooth'), isMac = navigator.appVersion.toLowerCase().indexOf('mac') > -1 ? true : false, isTouchDevice = qodef.html.hasClass('touchevents'), isMobileIE = navigator.userAgent.indexOf("IEMobile") > -1 ? true : false; if (smoothScrollEnabled && !isMac && !isTouchDevice && !isMobileIE) { gsap.registerPlugin(ScrollToPlugin); qodefSmoothScroll.startSmoothScroll(); } }, isRabbitToolbarOpened: function () { var $rabbitToolbar = $('.rbt-toolbar .rbt-sidearea'); if ($rabbitToolbar.length) { if ($rabbitToolbar.hasClass('rbt-active')) return true; return false; } }, startSmoothScroll: function () { if (window.addEventListener) { window.addEventListener('mousewheel', function (e) { !qodefSmoothScroll.isRabbitToolbarOpened() && qodefSmoothScroll.smoothScrollListener(e); }, { passive: false }); } }, getScrollSpeed: (function () { var lastPos, newPos, timer, delta; function clear() { lastPos = null; delta = 0; } clear(); return function () { newPos = window.scrollY; if (lastPos != null) { delta = newPos - lastPos; } lastPos = newPos; clearTimeout(timer); timer = setTimeout(clear, 50); return delta; }; })(), smoothScrollListener: function (event) { event.preventDefault(); var scrollTime = .9, scrollDir = event.deltaY < 0 ? 1 : -1, scrollTop = qodef.window.scrollTop(), scrollSpeed = Math.abs(qodefSmoothScroll.getScrollSpeed()); // Scroll Speed Boundaries scrollSpeed < 5 ? scrollSpeed = 5 : null; scrollSpeed > 80 ? scrollSpeed = 80 : null; var finalScroll = scrollTop - parseInt(scrollDir * scrollSpeed * 12); // coefficient gsap.to( qodef.window, scrollTime, { scrollTo: { y: finalScroll, autoKill: !0 }, ease: Power3.easeOut, overwrite: 'all' }); } } })(jQuery);
[+]
..
[-] smooth-scroll.js
[edit]