Authored by zhangxiaoru

品牌索引

... ... @@ -8,7 +8,6 @@ var $ = require('yoho-jquery');
var FastClick = require('yoho-fastclick');
var $nav = $('.category-nav'),
$search = $('#search-input'),
$categoryContainer = $('.category-container'),
$contents = $categoryContainer.children('.content'),
$subLevelItem = $categoryContainer.find('.sub-level li');
... ... @@ -19,15 +18,12 @@ $(function() {
});
function resetHeight() {
var h = document.body.scrollHeight - $search.outerHeight() - $nav.outerHeight();
var h = document.body.scrollHeight - $nav.outerHeight();
$contents.height(h);
}
resetHeight();
$search.focus(function() {
$(this).blur();
});
$nav.on('contextmenu', function() {
return false;
});
... ...
... ... @@ -4,9 +4,7 @@ var $ = require('yoho-jquery'),
var categoryHeight = $('.tab-box').height(),
gender;
var $intercept = $('.no-intercept'),
$list = $('.brand-list-box'),
$listBox = $('.list-box'),
var $listBox = $('.list-box'),
$brandContent = $('.brand-content'),
$tabBox = $('.tab-box'),
$contentIndex = $('.content-index'),
... ... @@ -28,6 +26,19 @@ function channels(key) {
return channel[key];
}
// 点击字母,页面滚动到相关区域
function reference() {
$('.no-intercept').click(function() {
var name = $(this).attr('href').split('#')[1] === '0_9' ? '0~9' : $(this).attr('href').split('#')[1],
targetTop = $('.brand-list-box').find('[name="' + name + '"]').offset().top - categoryHeight;
$('html,body').animate({
scrollTop: targetTop
}, 200);
return false;
});
}
function initialize() {
$('.banner-swiper').each(function() {
if (!$(this).parents('.content').hasClass('hide') && $(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
... ... @@ -65,6 +76,8 @@ function loadData(channel) {
$tabBox.removeClass('fastening');
$contentIndex.removeClass('distance');
});
reference();
}
});
}
... ... @@ -77,16 +90,7 @@ $brandCha.find('li').click(function() {
loadData(channels(gender));
});
// 点击字母,页面滚动到相关区域
$intercept.click(function() {
var name = $(this).attr('href').split('#')[1] === '0_9' ? '0~9' : $(this).attr('href').split('#')[1],
targetTop = $list.find('[name="' + name + '"]').offset().top - categoryHeight;
$('html,body').animate({
scrollTop: targetTop
}, 200);
return false;
});
reference();
$('.brand-tab').find('li').click(function() {
... ...
... ... @@ -20,7 +20,7 @@
text-align: center;
z-index: 10;
background-color: #fff;
padding: 0 200px 84px;
padding: 0 222px 84px;
border-bottom: 5px solid #e0e0e0;
width: 100%;
... ...