File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99/* ===============================================================================
1010************ ScrollFix ************
1111=============================================================================== */
12- + function ( ) {
12+
13+ /* global Zepto:true */
14+ + function ( $ ) {
1315 "use strict" ;
1416 var ScrollFix = function ( elem ) {
1517
3537 elem . scrollTop = elem . scrollHeight - elem . offsetHeight - 1 ;
3638 } , false ) ;
3739 } ;
38- var scrollable = document . getElementsByClassName ( "content" ) [ 0 ] ;
3940
40- [ "nav" , "footer" ] . forEach ( function ( item ) {
41- var elem = document . getElementsByClassName ( "bar-" + item ) ;
42- if ( elem . length > 0 ) {
43- elem [ 0 ] . addEventListener ( "touchmove" , function ( event ) {
44-
45- event . preventDefault ( ) ;
41+ function init ( ) {
42+ var prefix = $ ( '.page-current' ) . length > 0 ? '.page-current ' : '' ;
43+ var scrollable = $ ( prefix + ".content" ) ;
44+ [ "nav" , "footer" ] . forEach ( function ( item ) {
45+ var elem = $ ( prefix + ".bar-" + item ) ;
46+ elem . off ( $ . touchEvents . move ) ;
47+ elem . on ( $ . touchEvents . move , function ( event ) {
48+ if ( event . type === 'touchmove' ) {
49+ event . preventDefault ( ) ;
50+ }
4651 } ) ;
47- }
48- } ) ;
49- new ScrollFix ( scrollable ) ;
50- } ( ) ;
52+ } ) ;
53+ new ScrollFix ( scrollable [ 0 ] ) ;
54+ }
55+
56+ window . addEventListener ( 'pageLoadComplete' , init ) ;
57+ init ( ) ;
58+ } ( Zepto ) ;
You can’t perform that action at this time.
0 commit comments