Authored by Lynnic

为块级元素添加tap跳转事件处理 --code reviewed by bikai

... ... @@ -9,7 +9,7 @@ var $ = require('jquery'),
var commentsNum,consultsNum;
var consultFooterEle = document.getElementById('consult-content-footer'),
var consultFooterEle = $('.consult-content-footer')[0],
consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle),
navtabEle = document.getElementById('nav-tab'),
... ... @@ -68,13 +68,13 @@ if (navtabHammer) {
if (consultFooterHammer) {
consultFooterHammer.on('tap', function() {
location.href = $(consultFooterEle).find('a').attr('href');
location.href = $(consultFooterEle).data('href');
});
}
if (gotoConsultHammer) {
gotoConsultHammer.on('tap', function() {
location.href = $(gotoConsultEle).find('a').attr('href');
location.href = $(gotoConsultEle).data('href');
});
}
... ...
{{> layout/header}}
<div class="goods-consults-page yoho-page">
<div class="goto-consult" id="goto-consult">
<div class="goto-consult" id="goto-consult" data-href="{{link}}">
<i class="iconfont consult-logo">&#xe639;</i>
<span>我要咨询</span>
<a href="{{link}}" class="iconfont enter-consult-page">&#xe604;</a>
<a href="javascript:;" class="iconfont enter-consult-page">&#xe604;</a>
</div>
{{# consults}}
<div class="goods-consults" id="goods-consults">
... ...
... ... @@ -49,8 +49,8 @@
</div>
{{/ consults}}
</div>
<div class="consult-content-footer" id="consult-content-footer">
<a href="{{link}}">
<div class="consult-content-footer" data-href="{{link}}">
<a href="javascript:;">
查看更多
<span class="iconfont">&#xe604;</span></a>
</div>
... ... @@ -58,8 +58,9 @@
<div class="consult-content-main content-main no-item">
<span class="iconfont">&#xe63f;</span>暂无咨询
</div>
<div class="consult-content-footer">
<a href="{{link}}">
<div class="consult-content-footer" data-href="{{link}}">
<a href="javascript:;">
我要咨询
<span class="iconfont">&#xe604;</span></a>
</div>
... ...