Authored by ccbikai

品牌页面 品牌列表滚动字母置顶

... ... @@ -8,7 +8,8 @@ var $ = require('yoho.zepto'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.zeptolazyload');
var swiper;
var swiper,
$brandList = $('.brand-list');
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
... ... @@ -23,3 +24,22 @@ $('.yoho-header').css({
position: 'fixed'
});
$('.banner-top').css('padding-top', '90px');
if($brandList.length > 0){
$(window).scroll(function(){
var scrTop = $(window).scrollTop(),
searchH = $('.newbrand-search').height(),
headerH = $('.yoho-header').height(),
brandSwipe = parseInt(searchH) + parseInt(headerH);
$('.brand-list').each(function(){
var offTop = $(this).offset().top - brandSwipe;
if(scrTop >= offTop){
$brandList.find('.title-bar').css('position','static');
$(this).find('.title-bar').css({'position':'fixed', 'top':brandSwipe});
}else{
$(this).find('.title-bar').css('position','static');
}
});
});
}
... ...