SHODOC/pc/ver2/common/js/jquery.plugin.js
/**
        * Scrolls the site to the given element and scrolls to the slide if a callback is given.
        */
Scrolls the site to the given element and scrolls to the slide if a callback is given.
Scrolls the site to the given element and scrolls to the slide if a callback is given .
function scrollPage(element, callback, isMovementUp){
            requestAnimFrame(function(){
                var dest = element.position();
                if(typeof dest === 'undefined'){ return; } 
                var dtop = getDestinationPosition(dest, element);
                var v = {
                    element: element,
                    callback: callback,
                    isMovementUp: isMovementUp,
                    dest: dest,
                    dtop: dtop,
                    yMovement: getYmovement(element),
                    anchorLink: element.data('anchor'),
                    sectionIndex: element.index(SECTION_SEL),
                    activeSlide: element.find(SLIDE_ACTIVE_SEL),
                    activeSection: $(SECTION_ACTIVE_SEL),
                    leavingSection: $(SECTION_ACTIVE_SEL).index(SECTION_SEL) + 1,
                    localIsResizing: isResizing
                };
                if((v.activeSection.is(element) && !isResizing) || (options.scrollBar && $window.scrollTop() === v.dtop && !element.hasClass(AUTO_HEIGHT) )){ return; }
                if(v.activeSlide.length){
                    var slideAnchorLink = v.activeSlide.data('anchor');
                    var slideIndex = v.activeSlide.index();
                }
                if (options.autoScrolling && options.continuousVertical && typeof (v.isMovementUp) !== "undefined" &&
                    ((!v.isMovementUp && v.yMovement == 'up') || 
                    (v.isMovementUp && v.yMovement == 'down'))) { 
                    v = createInfiniteSections(v);
                }
                if($.isFunction(options.onLeave) && !v.localIsResizing){
                    if(options.onLeave.call(v.activeSection, v.leavingSection, (v.sectionIndex + 1), v.yMovement) === false){
                        return;
                    }
                }
                stopMedia(v.activeSection);
                element.addClass(ACTIVE).siblings().removeClass(ACTIVE);
                lazyLoad(element);
                canScroll = false;
                setState(slideIndex, slideAnchorLink, v.anchorLink, v.sectionIndex);
                performMovement(v);
                lastScrolledDestiny = v.anchorLink;
                activateMenuAndNav(v.anchorLink, v.sectionIndex);
            });
        }
function scrollPage ( element , callback , isMovementUp ) { requestAnimFrame ( function ( ) { var dest = element . position ( ) ; if ( typeof dest === 'undefined' ) { return ; } var dtop = getDestinationPosition ( dest , element ) ; var v = { element : element , callback : callback , isMovementUp : isMovementUp , dest : dest , dtop : dtop , yMovement : getYmovement ( element ) , anchorLink : element . data ( 'anchor' ) , sectionIndex : element . index ( SECTION_SEL ) , activeSlide : element . find ( SLIDE_ACTIVE_SEL ) , activeSection : $ ( SECTION_ACTIVE_SEL ) , leavingSection : $ ( SECTION_ACTIVE_SEL ) . index ( SECTION_SEL ) + 1 , localIsResizing : isResizing } ; if ( ( v . activeSection . is ( element ) && ! isResizing ) || ( options . scrollBar && $window . scrollTop ( ) === v . dtop && ! element . hasClass ( AUTO_HEIGHT ) ) ) { return ; } if ( v . activeSlide . length ) { var slideAnchorLink = v . activeSlide . data ( 'anchor' ) ; var slideIndex = v . activeSlide . index ( ) ; } if ( options . autoScrolling && options . continuousVertical && typeof ( v . isMovementUp ) !== "undefined" && ( ( ! v . isMovementUp && v . yMovement == 'up' ) || ( v . isMovementUp && v . yMovement == 'down' ) ) ) { v = createInfiniteSections ( v ) ; } if ( $ . isFunction ( options . onLeave ) && ! v . localIsResizing ) { if ( options . onLeave . call ( v . activeSection , v . leavingSection , ( v . sectionIndex + 1 ) , v . yMovement ) === false ) { return ; } } stopMedia ( v . activeSection ) ; element . addClass ( ACTIVE ) . siblings ( ) . removeClass ( ACTIVE ) ; lazyLoad ( element ) ; canScroll = false ; setState ( slideIndex , slideAnchorLink , v . anchorLink , v . sectionIndex ) ; performMovement ( v ) ; lastScrolledDestiny = v . anchorLink ; activateMenuAndNav ( v . anchorLink , v . sectionIndex ) ; } ) ; }
Scrolls the site to the given element and scrolls to the slide if a callback is given.
Scrolls the site to the given element and scrolls to the slide if a callback is given .
//requestAnimFrame is used in order to prevent a Chrome 44 bug (http://stackoverflow.com/a/31961816/1081396) //there's no element to scroll, leaving the function //local variables //caching the value of isResizing at the momment the function is called //because it will be checked later inside a setTimeout and the value might change //quiting when destination scroll is the same as the current one // If continuousVertical && we need to wrap around // Intending to scroll down but about to go up or // intending to scroll up but about to go down //callback (onLeave) if the site is not just resizing and readjusting the slides //preventing from activating the MouseWheelHandler event //more than once if the page is scrolling //flag to avoid callingn `scrollPage()` twice in case of using anchor links //avoid firing it twice (as it does also on scroll)