Showing
1 changed file
with
22 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,23 @@ $('.yoho-header').css({ | @@ -22,4 +23,23 @@ $('.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 | + | ||
29 | +if($brandList.length > 0){ | ||
30 | + $(window).scroll(function(){ | ||
31 | + var scrTop = $(window).scrollTop(), | ||
32 | + searchH = $('.newbrand-search').height(), | ||
33 | + headerH = $('.yoho-header').height(), | ||
34 | + brandSwipe = parseInt(searchH) + parseInt(headerH); | ||
35 | + $('.brand-list').each(function(){ | ||
36 | + var offTop = $(this).offset().top - brandSwipe; | ||
37 | + if(scrTop >= offTop){ | ||
38 | + $brandList.find('.title-bar').css('position','static'); | ||
39 | + $(this).find('.title-bar').css({'position':'fixed', 'top':brandSwipe}); | ||
40 | + }else{ | ||
41 | + $(this).find('.title-bar').css('position','static'); | ||
42 | + } | ||
43 | + }); | ||
44 | + }); | ||
45 | +} |
-
Please register or login to post a comment