Merge branch 'bugfix' into develop
Showing
1 changed file
with
26 additions
and
2 deletions
@@ -8,7 +8,8 @@ var $ = require('yoho.zepto'), | @@ -8,7 +8,8 @@ var $ = require('yoho.zepto'), | ||
8 | Swiper = require('yoho.iswiper'), | 8 | Swiper = require('yoho.iswiper'), |
9 | lazyLoad = require('yoho.zeptolazyload'); | 9 | lazyLoad = require('yoho.zeptolazyload'); |
10 | 10 | ||
11 | -var swiper; | 11 | +var swiper, |
12 | + $brandList = $('.brand-list'); | ||
12 | 13 | ||
13 | swiper = new Swiper('.swiper-container', { | 14 | swiper = new Swiper('.swiper-container', { |
14 | lazyLoading: true, | 15 | lazyLoading: true, |
@@ -22,4 +23,27 @@ $('.yoho-header').css({ | @@ -22,4 +23,27 @@ $('.yoho-header').css({ | ||
22 | 'z-index': 2, | 23 | 'z-index': 2, |
23 | position: 'fixed' | 24 | position: 'fixed' |
24 | }); | 25 | }); |
25 | -$('.banner-top').css('padding-top', '90px'); | ||
26 | +$('.banner-top').css('padding-top', '90px'); | ||
27 | + | ||
28 | +if ($brandList.length > 0) { | ||
29 | + $(window).scroll(function() { | ||
30 | + var scrTop = $(window).scrollTop(), | ||
31 | + searchH = $('.newbrand-search').height(), | ||
32 | + headerH = $('.yoho-header').height(), | ||
33 | + brandSwipe = parseInt(searchH) + parseInt(headerH); | ||
34 | + | ||
35 | + $('.brand-list').each(function() { | ||
36 | + var offTop = $(this).offset().top - brandSwipe; | ||
37 | + | ||
38 | + if (scrTop >= offTop) { | ||
39 | + $brandList.find('.title-bar').css('position', 'static'); | ||
40 | + $(this).find('.title-bar').css({ | ||
41 | + position: 'fixed', | ||
42 | + top: brandSwipe | ||
43 | + }); | ||
44 | + } else { | ||
45 | + $(this).find('.title-bar').css('position', 'static'); | ||
46 | + } | ||
47 | + }); | ||
48 | + }); | ||
49 | +} |
-
Please register or login to post a comment