Authored by zhangxiaoru

品牌索引

@@ -8,7 +8,6 @@ var $ = require('yoho-jquery'); @@ -8,7 +8,6 @@ var $ = require('yoho-jquery');
8 var FastClick = require('yoho-fastclick'); 8 var FastClick = require('yoho-fastclick');
9 9
10 var $nav = $('.category-nav'), 10 var $nav = $('.category-nav'),
11 - $search = $('#search-input'),  
12 $categoryContainer = $('.category-container'), 11 $categoryContainer = $('.category-container'),
13 $contents = $categoryContainer.children('.content'), 12 $contents = $categoryContainer.children('.content'),
14 $subLevelItem = $categoryContainer.find('.sub-level li'); 13 $subLevelItem = $categoryContainer.find('.sub-level li');
@@ -19,15 +18,12 @@ $(function() { @@ -19,15 +18,12 @@ $(function() {
19 }); 18 });
20 19
21 function resetHeight() { 20 function resetHeight() {
22 - var h = document.body.scrollHeight - $search.outerHeight() - $nav.outerHeight(); 21 + var h = document.body.scrollHeight - $nav.outerHeight();
23 22
24 $contents.height(h); 23 $contents.height(h);
25 } 24 }
26 resetHeight(); 25 resetHeight();
27 26
28 -$search.focus(function() {  
29 - $(this).blur();  
30 -});  
31 $nav.on('contextmenu', function() { 27 $nav.on('contextmenu', function() {
32 return false; 28 return false;
33 }); 29 });
@@ -4,9 +4,7 @@ var $ = require('yoho-jquery'), @@ -4,9 +4,7 @@ var $ = require('yoho-jquery'),
4 var categoryHeight = $('.tab-box').height(), 4 var categoryHeight = $('.tab-box').height(),
5 gender; 5 gender;
6 6
7 -var $intercept = $('.no-intercept'),  
8 - $list = $('.brand-list-box'),  
9 - $listBox = $('.list-box'), 7 +var $listBox = $('.list-box'),
10 $brandContent = $('.brand-content'), 8 $brandContent = $('.brand-content'),
11 $tabBox = $('.tab-box'), 9 $tabBox = $('.tab-box'),
12 $contentIndex = $('.content-index'), 10 $contentIndex = $('.content-index'),
@@ -28,6 +26,19 @@ function channels(key) { @@ -28,6 +26,19 @@ function channels(key) {
28 return channel[key]; 26 return channel[key];
29 } 27 }
30 28
  29 +// 点击字母,页面滚动到相关区域
  30 +function reference() {
  31 + $('.no-intercept').click(function() {
  32 + var name = $(this).attr('href').split('#')[1] === '0_9' ? '0~9' : $(this).attr('href').split('#')[1],
  33 + targetTop = $('.brand-list-box').find('[name="' + name + '"]').offset().top - categoryHeight;
  34 +
  35 + $('html,body').animate({
  36 + scrollTop: targetTop
  37 + }, 200);
  38 + return false;
  39 + });
  40 +}
  41 +
31 function initialize() { 42 function initialize() {
32 $('.banner-swiper').each(function() { 43 $('.banner-swiper').each(function() {
33 if (!$(this).parents('.content').hasClass('hide') && $(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) { 44 if (!$(this).parents('.content').hasClass('hide') && $(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
@@ -65,6 +76,8 @@ function loadData(channel) { @@ -65,6 +76,8 @@ function loadData(channel) {
65 $tabBox.removeClass('fastening'); 76 $tabBox.removeClass('fastening');
66 $contentIndex.removeClass('distance'); 77 $contentIndex.removeClass('distance');
67 }); 78 });
  79 +
  80 + reference();
68 } 81 }
69 }); 82 });
70 } 83 }
@@ -77,16 +90,7 @@ $brandCha.find('li').click(function() { @@ -77,16 +90,7 @@ $brandCha.find('li').click(function() {
77 loadData(channels(gender)); 90 loadData(channels(gender));
78 }); 91 });
79 92
80 -// 点击字母,页面滚动到相关区域  
81 -$intercept.click(function() {  
82 - var name = $(this).attr('href').split('#')[1] === '0_9' ? '0~9' : $(this).attr('href').split('#')[1],  
83 - targetTop = $list.find('[name="' + name + '"]').offset().top - categoryHeight;  
84 -  
85 - $('html,body').animate({  
86 - scrollTop: targetTop  
87 - }, 200);  
88 - return false;  
89 -}); 93 +reference();
90 94
91 $('.brand-tab').find('li').click(function() { 95 $('.brand-tab').find('li').click(function() {
92 96
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 text-align: center; 20 text-align: center;
21 z-index: 10; 21 z-index: 10;
22 background-color: #fff; 22 background-color: #fff;
23 - padding: 0 200px 84px; 23 + padding: 0 222px 84px;
24 border-bottom: 5px solid #e0e0e0; 24 border-bottom: 5px solid #e0e0e0;
25 width: 100%; 25 width: 100%;
26 26