评论咨询tab跳转要绑定到外层元素上 -- code reviewed by zhaobiao
Showing
3 changed files
with
16 additions
and
5 deletions
@@ -4,12 +4,17 @@ | @@ -4,12 +4,17 @@ | ||
4 | * @date: 2015/11/18 | 4 | * @date: 2015/11/18 |
5 | */ | 5 | */ |
6 | var $ = require('jquery'), | 6 | var $ = require('jquery'), |
7 | - tip = require('../../plugin/tip'); | ||
8 | -var commentsNum; | 7 | + tip = require('../../plugin/tip'), |
8 | + Hammer = require('yoho.hammer'); | ||
9 | + | ||
10 | +var commentsNum,consultsNum; | ||
11 | + | ||
12 | +var consultFooterEle = document.getElementById('consult-content-footer'), | ||
13 | + consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle); | ||
9 | 14 | ||
10 | 15 | ||
11 | (function() { | 16 | (function() { |
12 | - var consultsNum = $('#nav-tab .consults-num').html() - 0; | 17 | + consultsNum = $('#nav-tab .consults-num').html() - 0; |
13 | 18 | ||
14 | commentsNum = $('#nav-tab .comments-num').html() - 0; | 19 | commentsNum = $('#nav-tab .comments-num').html() - 0; |
15 | 20 | ||
@@ -51,3 +56,9 @@ $('#nav-tab li').on('touchend', function() { | @@ -51,3 +56,9 @@ $('#nav-tab li').on('touchend', function() { | ||
51 | } | 56 | } |
52 | } | 57 | } |
53 | }); | 58 | }); |
59 | + | ||
60 | +if (consultFooterHammer) { | ||
61 | + consultFooterHammer.on('tap', function() { | ||
62 | + location.href = $(consultFooterEle).find('a').attr('href'); | ||
63 | + }); | ||
64 | +} |
@@ -122,7 +122,7 @@ | @@ -122,7 +122,7 @@ | ||
122 | <a href="{{cartUrl}}" class="num-incart iconfont"></a> | 122 | <a href="{{cartUrl}}" class="num-incart iconfont"></a> |
123 | 123 | ||
124 | {{#if addToCart}} | 124 | {{#if addToCart}} |
125 | - <a href="{{addToCartUrl}}" class="addto-cart">加入购物车</a> | 125 | + <a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a> |
126 | {{/if}} | 126 | {{/if}} |
127 | 127 | ||
128 | {{#if soldOut}} | 128 | {{#if soldOut}} |
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | </div> | 49 | </div> |
50 | {{/ consults}} | 50 | {{/ consults}} |
51 | </div> | 51 | </div> |
52 | - <div class="consult-content-footer"> | 52 | + <div class="consult-content-footer" id="consult-content-footer"> |
53 | <a href="{{link}}"> | 53 | <a href="{{link}}"> |
54 | 查看更多 | 54 | 查看更多 |
55 | <span class="iconfont"></span></a> | 55 | <span class="iconfont"></span></a> |
-
Please register or login to post a comment