@@ -618,9 +618,12 @@ $(document).on("change", function(event) {
618618 }
619619} ) ;
620620
621+ var $page = $ ( 'html, body' ) ;
622+
621623$ ( document ) . on ( 'click' , 'a[data-load-content],button[data-load-content]' , function ( e ) {
622624 e . preventDefault ( ) ;
623- $ ( 'html, body' ) . animate ( { scrollTop : 0 } , 1000 ) ;
625+ $page . on ( 'scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove' , function ( ) { $page . stop ( ) ; } ) ;
626+ $page . animate ( { scrollTop : 0 } , 1000 , function ( ) { $page . off ( 'scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove' , function ( ) { $page . stop ( ) ; } ) ; } ) ;
624627
625628 var content_to_load = $ ( this ) . attr ( 'data-load-content' ) ;
626629 if ( ! content_to_load ) return this ;
@@ -630,7 +633,8 @@ $(document).on('click', 'a[data-load-content],button[data-load-content]', functi
630633
631634$ ( document ) . on ( 'click' , 'a[data-capp],button[data-capp]' , function ( e ) {
632635 e . preventDefault ( ) ;
633- $ ( 'html, body' ) . animate ( { scrollTop : 0 } , 1000 ) ;
636+ $page . on ( 'scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove' , function ( ) { $page . stop ( ) ; } ) ;
637+ $page . animate ( { scrollTop : 0 } , 1000 , function ( ) { $page . off ( 'scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove' , function ( ) { $page . stop ( ) ; } ) ; } ) ;
634638
635639 var content_to_load = $ ( this ) . attr ( 'data-capp' ) ;
636640 if ( ! content_to_load ) return this ;
@@ -640,7 +644,8 @@ $(document).on('click', 'a[data-capp],button[data-capp]', function(e) {
640644
641645$ ( document ) . on ( 'click' , 'a[data-submit-form],button[data-submit-form]' , function ( e ) {
642646 e . preventDefault ( ) ;
643- $ ( 'html, body' ) . animate ( { scrollTop : 0 } , 1000 ) ;
647+ $page . on ( 'scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove' , function ( ) { $page . stop ( ) ; } ) ;
648+ $page . animate ( { scrollTop : 0 } , 1000 , function ( ) { $page . off ( 'scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove' , function ( ) { $page . stop ( ) ; } ) ; } ) ;
644649
645650 var $el = $ ( this ) ;
646651 var act = $el . attr ( 'data-form-action' ) ;
0 commit comments