Authored by uedxwg

hotrank添加导航高亮效果

@@ -82,6 +82,7 @@ $('#hotRank').on('touchend touchcancel', function(e) { @@ -82,6 +82,7 @@ $('#hotRank').on('touchend touchcancel', function(e) {
82 var target = ev.target || ev.srcElement; 82 var target = ev.target || ev.srcElement;
83 83
84 if (target.nodeName.toLowerCase() === 'span') { 84 if (target.nodeName.toLowerCase() === 'span') {
  85 + $('.s-goods-nav .nav-item').removeClass('active');
85 target.parentNode.className = 'active ' + target.parentNode.className; 86 target.parentNode.className = 'active ' + target.parentNode.className;
86 id = target.getAttribute('data-id') ? target.getAttribute('data-id') : ''; 87 id = target.getAttribute('data-id') ? target.getAttribute('data-id') : '';
87 sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : ''; 88 sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : '';
@@ -98,9 +99,9 @@ $('#hotRank').on('touchstart', function(e) { @@ -98,9 +99,9 @@ $('#hotRank').on('touchstart', function(e) {
98 var target = ev.target || ev.srcElement; 99 var target = ev.target || ev.srcElement;
99 100
100 if (target.nodeName.toLowerCase() === 'span') { 101 if (target.nodeName.toLowerCase() === 'span') {
101 - target.parentNode.className = 'active ' + target.parentNode.className; 102 + target.parentNode.className = 'bgActive ' + target.parentNode.className;
102 } 103 }
103 }).on('touchend touchcancel', function() { 104 }).on('touchend touchcancel', function() {
104 - $('.s-goods-nav .nav-item').removeClass('active'); 105 + $('.s-goods-nav .nav-item').removeClass('bgActive');
105 }); 106 });
106 107
@@ -138,6 +138,9 @@ @@ -138,6 +138,9 @@
138 color: #999; 138 color: #999;
139 &.active{ 139 &.active{
140 color: #000; 140 color: #000;
  141 + }
  142 + &.bgActive{
  143 + color: #000;
141 background-color:#e0e0e0; 144 background-color:#e0e0e0;
142 } 145 }
143 a { 146 a {
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <ul class="swiper-wrapper clearfix"> 3 <ul class="swiper-wrapper clearfix">
4 {{# tabs}} 4 {{# tabs}}
5 {{# title}} 5 {{# title}}
6 - <li class="swiper-slide nav-item"> 6 + <li class="swiper-slide nav-item {{#if @first}} active{{/if}}">
7 <span data-sort="{{ params}}" data-id="{{ id}}" >{{ name}}</span> 7 <span data-sort="{{ params}}" data-id="{{ id}}" >{{ name}}</span>
8 </li> 8 </li>
9 {{/ title}} 9 {{/ title}}