asv/www/asv.js
/* Callback a function when an element comes in view */
Callback a function when an element comes in view
Callback a function when an element comes in view
function callback_in_view(element, func) {
        function handler(evt) {
            var visible = (
                (element.offset().top <= $(window).height() + $(window).scrollTop()) &&
                    (element.offset().top + element.height() >= $(window).scrollTop()));
            if (visible) {
                func();
                $(window).unbind('scroll', handler);
            }
        }
        $(window).on('scroll', handler);
        $(window).scroll();
    }
function callback_in_view ( element , func ) { function handler ( evt ) { var visible = ( ( element . offset ( ) . top <= $ ( window ) . height ( ) + $ ( window ) . scrollTop ( ) ) && ( element . offset ( ) . top + element . height ( ) >= $ ( window ) . scrollTop ( ) ) ) ; if ( visible ) { func ( ) ; $ ( window ) . unbind ( 'scroll' , handler ) ; } } $ ( window ) . on ( 'scroll' , handler ) ; $ ( window ) . scroll ( ) ; }
Callback a function when an element comes in view
Callback a function when an element comes in view