Authored by zhangxiaoru

索引不灵敏

@@ -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) {
@@ -79,19 +90,6 @@ $brandCha.find('li').click(function() { @@ -79,19 +90,6 @@ $brandCha.find('li').click(function() {
79 loadData(channels(gender)); 90 loadData(channels(gender));
80 }); 91 });
81 92
82 -// 点击字母,页面滚动到相关区域  
83 -function reference () {  
84 - $('.no-intercept').click(function() {  
85 - var name = $(this).attr('href').split('#')[1] === '0_9' ? '0~9' : $(this).attr('href').split('#')[1],  
86 - targetTop = $('.brand-list-box').find('[name="' + name + '"]').offset().top - categoryHeight;  
87 -  
88 - $('html,body').animate({  
89 - scrollTop: targetTop  
90 - }, 200);  
91 - return false;  
92 - });  
93 -}  
94 -  
95 reference(); 93 reference();
96 94
97 $('.brand-tab').find('li').click(function() { 95 $('.brand-tab').find('li').click(function() {