Showing
1 changed file
with
14 additions
and
22 deletions
@@ -87,7 +87,6 @@ var viewType = 1, // 1-首页,2-上新,3-人气 | @@ -87,7 +87,6 @@ var viewType = 1, // 1-首页,2-上新,3-人气 | ||
87 | listModValue = 4 - listCount % 4, | 87 | listModValue = 4 - listCount % 4, |
88 | listIndex; | 88 | listIndex; |
89 | 89 | ||
90 | -lazyLoad($('img.lazy')); | ||
91 | 90 | ||
92 | $('.main-wrap').css({ | 91 | $('.main-wrap').css({ |
93 | position: 'static' | 92 | position: 'static' |
@@ -186,7 +185,7 @@ function newData(callback) { | @@ -186,7 +185,7 @@ function newData(callback) { | ||
186 | 185 | ||
187 | req.url = location.protocol + '//m.yohobuy.com/index/search/search'; | 186 | req.url = location.protocol + '//m.yohobuy.com/index/search/search'; |
188 | req.data = { | 187 | req.data = { |
189 | - type: 'newest', | 188 | + type: 'new', |
190 | order: '1', | 189 | order: '1', |
191 | page: navInfo.new.page, | 190 | page: navInfo.new.page, |
192 | tagNew: '1' | 191 | tagNew: '1' |
@@ -265,13 +264,11 @@ function tabChange(dom, index) { | @@ -265,13 +264,11 @@ function tabChange(dom, index) { | ||
265 | hotData(); | 264 | hotData(); |
266 | viewType = 3; | 265 | viewType = 3; |
267 | } else if (activeTab === 'home-page') { | 266 | } else if (activeTab === 'home-page') { |
268 | - | ||
269 | - myScroll && myScroll.refresh(); | ||
270 | - scH = $('#scroller').outerHeight(); | ||
271 | $nav1.removeClass('fixed-top absolute'); | 267 | $nav1.removeClass('fixed-top absolute'); |
272 | $nav2.removeClass('fixed-top absolute'); | 268 | $nav2.removeClass('fixed-top absolute'); |
273 | } | 269 | } |
274 | - | 270 | + myScroll && myScroll.refresh(); |
271 | + scH = $('#scroller').outerHeight(); | ||
275 | if (!$nav1.hasClass('hide')) { | 272 | if (!$nav1.hasClass('hide')) { |
276 | myScroll && myScroll.scrollTo(0, 0 - imgH); | 273 | myScroll && myScroll.scrollTo(0, 0 - imgH); |
277 | } | 274 | } |
@@ -448,7 +445,7 @@ document.addEventListener('touchmove', function(e) { | @@ -448,7 +445,7 @@ document.addEventListener('touchmove', function(e) { | ||
448 | 445 | ||
449 | // window ready 后重新refresh iscroll | 446 | // window ready 后重新refresh iscroll |
450 | $(window).ready(function() { | 447 | $(window).ready(function() { |
451 | - // myScroll && myScroll.refresh(); | 448 | + myScroll && myScroll.refresh(); |
452 | imgH = $('#nav-top').outerHeight(); | 449 | imgH = $('#nav-top').outerHeight(); |
453 | nav1H = $('#nav').outerHeight(); | 450 | nav1H = $('#nav').outerHeight(); |
454 | main1H = $('#nav-main').height(); | 451 | main1H = $('#nav-main').height(); |
@@ -463,15 +460,12 @@ $(window).ready(function() { | @@ -463,15 +460,12 @@ $(window).ready(function() { | ||
463 | click: true | 460 | click: true |
464 | }); | 461 | }); |
465 | 462 | ||
466 | - // setTimeout(function() { | 463 | + setTimeout(function() { |
467 | scH = $('#scroller').outerHeight(); | 464 | scH = $('#scroller').outerHeight(); |
468 | - | ||
469 | - // }, 1000); | 465 | + }, 1000); |
470 | 466 | ||
471 | 467 | ||
472 | - myScroll.on('scroll', function() { | ||
473 | - window.requestAnimationFrame(scrollHandler); | ||
474 | - }); | 468 | + myScroll.on('scroll', scrollHandler); |
475 | 469 | ||
476 | myScroll.on('scrollStart', function() { | 470 | myScroll.on('scrollStart', function() { |
477 | 471 | ||
@@ -489,8 +483,9 @@ $(window).ready(function() { | @@ -489,8 +483,9 @@ $(window).ready(function() { | ||
489 | multiSwiper && multiSwiper.startAutoplay(); | 483 | multiSwiper && multiSwiper.startAutoplay(); |
490 | 484 | ||
491 | $('#scroller').trigger('scroll'); | 485 | $('#scroller').trigger('scroll'); |
486 | + scrollHandler.bind(this)(); | ||
492 | }); | 487 | }); |
493 | - | 488 | + lazyLoad($('img.lazy')); |
494 | }); | 489 | }); |
495 | 490 | ||
496 | function bindGoodThumbClick() { | 491 | function bindGoodThumbClick() { |
@@ -660,10 +655,7 @@ function search(opt) { | @@ -660,10 +655,7 @@ function search(opt) { | ||
660 | 655 | ||
661 | window.rePosFooter(); | 656 | window.rePosFooter(); |
662 | 657 | ||
663 | - setTimeout(function() { | ||
664 | - myScroll && myScroll.refresh(); | ||
665 | - }, 0); | ||
666 | - | 658 | + myScroll.refresh(); |
667 | reNav1Pos(); | 659 | reNav1Pos(); |
668 | 660 | ||
669 | bindGoodThumbClick(); | 661 | bindGoodThumbClick(); |
@@ -831,7 +823,7 @@ $subNav.on('touchend touchcancel', function(e) { | @@ -831,7 +823,7 @@ $subNav.on('touchend touchcancel', function(e) { | ||
831 | filter.initFilter({ | 823 | filter.initFilter({ |
832 | fCbFn: function(option) { | 824 | fCbFn: function(option) { |
833 | search(option); | 825 | search(option); |
834 | - myScroll.enable(); | 826 | + myScroll && myScroll.enable(); |
835 | }, | 827 | }, |
836 | hCbFn: function() { | 828 | hCbFn: function() { |
837 | 829 | ||
@@ -839,7 +831,7 @@ filter.initFilter({ | @@ -839,7 +831,7 @@ filter.initFilter({ | ||
839 | $pre.addClass('active'); | 831 | $pre.addClass('active'); |
840 | $pre.siblings('.filter').removeClass('active'); | 832 | $pre.siblings('.filter').removeClass('active'); |
841 | 833 | ||
842 | - myScroll.enable(); | 834 | + myScroll && myScroll.enable(); |
843 | }, | 835 | }, |
844 | missStatus: true | 836 | missStatus: true |
845 | }); | 837 | }); |
@@ -848,14 +840,14 @@ $listNav.on('touchstart', 'li', function(e) { | @@ -848,14 +840,14 @@ $listNav.on('touchstart', 'li', function(e) { | ||
848 | $(this).addClass('bytouch'); | 840 | $(this).addClass('bytouch'); |
849 | }).on('touchend touchcancel', function() { | 841 | }).on('touchend touchcancel', function() { |
850 | $listNav.find('li').removeClass('bytouch'); | 842 | $listNav.find('li').removeClass('bytouch'); |
851 | - myScroll.refresh(); | 843 | + myScroll && myScroll.refresh(); |
852 | }); | 844 | }); |
853 | 845 | ||
854 | $nav2.on('touchstart', 'li', function(e) { | 846 | $nav2.on('touchstart', 'li', function(e) { |
855 | $(this).addClass('bytouch'); | 847 | $(this).addClass('bytouch'); |
856 | }).on('touchend touchcancel', function() { | 848 | }).on('touchend touchcancel', function() { |
857 | $nav2.find('li').removeClass('bytouch'); | 849 | $nav2.find('li').removeClass('bytouch'); |
858 | - myScroll.refresh(); | 850 | + myScroll && myScroll.refresh(); |
859 | }); | 851 | }); |
860 | 852 | ||
861 | // 底部导航点击 | 853 | // 底部导航点击 |
-
Please register or login to post a comment