SAMYANG/m/asset/js/sy.m.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) {
            if (typeof element === 'undefined') {
                return;
            } 
            var dtop = getDestinationPosition(element);
            var slideAnchorLink;
            var slideIndex;
            var v = {
                element: element,
                callback: callback,
                isMovementUp: isMovementUp,
                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) {
                slideAnchorLink = v.activeSlide.data('anchor');
                slideIndex = v.activeSlide.index();
            }
            if ($.isFunction(options.onLeave) && !v.localIsResizing) {
                var direction = v.yMovement;
                if (typeof isMovementUp !== 'undefined') {
                    direction = isMovementUp ? 'up' : 'down';
                }
                if (options.onLeave.call(v.activeSection, v.leavingSection, (v.sectionIndex + 1), direction) === false) {
                    return;
                }
            }
            if (options.autoScrolling && options.continuousVertical && typeof (v.isMovementUp) !== "undefined" &&
                ((!v.isMovementUp && v.yMovement == 'up') || 
                    (v.isMovementUp && v.yMovement == 'down'))) { 
                v = createInfiniteSections(v);
            }
            if (!v.localIsResizing) {
                stopMedia(v.activeSection);
            }
            if (options.scrollOverflow) {
                options.scrollOverflowHandler.beforeLeave();
            }
            element.addClass(ACTIVE).siblings().removeClass(ACTIVE);
            lazyLoad(element);
            if (options.scrollOverflow) {
                options.scrollOverflowHandler.onLeave();
            }
            canScroll = false;
            setState(slideIndex, slideAnchorLink, v.anchorLink, v.sectionIndex);
            performMovement(v);
            lastScrolledDestiny = v.anchorLink;
            activateMenuAndNav(v.anchorLink, v.sectionIndex);
        }
function scrollPage ( element , callback , isMovementUp ) { if ( typeof element === 'undefined' ) { return ; } var dtop = getDestinationPosition ( element ) ; var slideAnchorLink ; var slideIndex ; var v = { element : element , callback : callback , isMovementUp : isMovementUp , 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 ) { slideAnchorLink = v . activeSlide . data ( 'anchor' ) ; slideIndex = v . activeSlide . index ( ) ; } if ( $ . isFunction ( options . onLeave ) && ! v . localIsResizing ) { var direction = v . yMovement ; if ( typeof isMovementUp !== 'undefined' ) { direction = isMovementUp ? 'up' : 'down' ; } if ( options . onLeave . call ( v . activeSection , v . leavingSection , ( v . sectionIndex + 1 ) , direction ) === false ) { return ; } } if ( options . autoScrolling && options . continuousVertical && typeof ( v . isMovementUp ) !== "undefined" && ( ( ! v . isMovementUp && v . yMovement == 'up' ) || ( v . isMovementUp && v . yMovement == 'down' ) ) ) { v = createInfiniteSections ( v ) ; } if ( ! v . localIsResizing ) { stopMedia ( v . activeSection ) ; } if ( options . scrollOverflow ) { options . scrollOverflowHandler . beforeLeave ( ) ; } element . addClass ( ACTIVE ) . siblings ( ) . removeClass ( ACTIVE ) ; lazyLoad ( element ) ; if ( options . scrollOverflow ) { options . scrollOverflowHandler . onLeave ( ) ; } 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 .
//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 //callback (onLeave) if the site is not just resizing and readjusting the slides //required for continousVertical // 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 //pausing media of the leaving section (if we are not just resizing, as destinatino will be the same one) //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)