Showing
1 changed file
with
13 additions
and
9 deletions
@@ -25,20 +25,24 @@ $('.yoho-header').css({ | @@ -25,20 +25,24 @@ $('.yoho-header').css({ | ||
25 | }); | 25 | }); |
26 | $('.banner-top').css('padding-top', '90px'); | 26 | $('.banner-top').css('padding-top', '90px'); |
27 | 27 | ||
28 | - | ||
29 | -if($brandList.length > 0){ | ||
30 | - $(window).scroll(function(){ | 28 | +if ($brandList.length > 0) { |
29 | + $(window).scroll(function() { | ||
31 | var scrTop = $(window).scrollTop(), | 30 | var scrTop = $(window).scrollTop(), |
32 | searchH = $('.newbrand-search').height(), | 31 | searchH = $('.newbrand-search').height(), |
33 | headerH = $('.yoho-header').height(), | 32 | headerH = $('.yoho-header').height(), |
34 | brandSwipe = parseInt(searchH) + parseInt(headerH); | 33 | brandSwipe = parseInt(searchH) + parseInt(headerH); |
35 | - $('.brand-list').each(function(){ | 34 | + |
35 | + $('.brand-list').each(function() { | ||
36 | var offTop = $(this).offset().top - brandSwipe; | 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'); | 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'); | ||
42 | } | 46 | } |
43 | }); | 47 | }); |
44 | }); | 48 | }); |
-
Please register or login to post a comment