Authored by ccbikai

品牌列表 字母 优化

... ... @@ -10,6 +10,7 @@ var $ = require('jquery'),
lazyLoad = require('yoho.lazyload');
var swiper,
$fixTitleBar,
$brandList = $('.brand-list');
var searchH = $('.newbrand-search').outerHeight(),
... ... @@ -38,21 +39,30 @@ $('.yoho-header').css({
top: 0
});
$fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
$fixTitleBar.hide();
$('.brand-list').last().append($fixTitleBar);
$(window).scroll(function() {
var scrTop = $(window).scrollTop();
var scrTop = $(window).scrollTop(),
minBrandListTop = brandSwipe + $('.hot-brand').outerHeight() +
$('.banner-top').outerHeight();
if ($brandList.eq(0).offset().top < minBrandListTop) {
$fixTitleBar.hide();
}
$('.brand-list').each(function() {
$brandList.each(function() {
var offTop = $(this).offset().top - brandSwipe;
if (scrTop >= offTop) {
$brandList.find('.title-bar').css('position', 'static');
$(this).find('.title-bar').css({
$fixTitleBar.css({
display: 'block',
position: 'fixed',
top: brandSwipe
});
} else {
$(this).find('.title-bar').css('position', 'static');
}).find('h2').html($(this).find('.title-bar').text());
}
});
});
... ...