Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ScrollDown = function () {
- var $el = $('.js-scroll-down');
- if (!$el.length) {
- return;
- }
- $el.on('click', function (e) {
- // this takes into consideration the header height
- // if you'd like you can replace "$('#page-header').height()" with
- // any number in pixels, e.g. "75"
- // Example:
- // var distance = window.innerHeight - 75;
- var distance = window.innerHeight - $('#page-header').height();
- e.preventDefault();
- $('html, body').animate({
- scrollTop: distance
- }, 600, 'swing');
- if (window.SB !== undefined) {
- window.SB.scrollTo(0, distance, 1200, {
- easing: function (pos) {
- if (pos === 0) return 0;
- if (pos === 1) return 1;
- if ((pos /= 0.5) < 1) return 0.5 * Math.pow(2, 10 * (pos - 1));
- return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
- }
- });
- }
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement