正在显示
2 个修改的文件
包含
15 行增加
和
8 行删除
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | <div class="ad_content"> | 26 | <div class="ad_content"> |
27 | <ul id="ad_contentUl"> | 27 | <ul id="ad_contentUl"> |
28 | <volist name="data" id="vo"> | 28 | <volist name="data" id="vo"> |
29 | - <li onclick="fors()"> | 29 | + <li ontouchstart="fors()"> |
30 | <div class="ad_conBox"> | 30 | <div class="ad_conBox"> |
31 | <div class="ad_con1"> | 31 | <div class="ad_con1"> |
32 | <p class="ad_conName">{$vo.name}</p> | 32 | <p class="ad_conName">{$vo.name}</p> |
1 | // 删除默认 | 1 | // 删除默认 |
2 | -document.addEventListener('DOMContentLoaded', function() { | 2 | +const clickEvent = (function() { |
3 | + if ('ontouchstart' in document.documentElement === true) | ||
4 | + return 'touchstart'; | ||
5 | + else | ||
6 | + return 'click'; | ||
7 | +})(); | ||
8 | +clickEvent.addEventListener('DOMContentLoaded', function(ev) { | ||
9 | + ev.preventDefault(); | ||
3 | // var oUl = document.getElementsById('ad_contentUl')[0]; | 10 | // var oUl = document.getElementsById('ad_contentUl')[0]; |
4 | var oUl = document.querySelector('#ad_contentUl'); | 11 | var oUl = document.querySelector('#ad_contentUl'); |
5 | var aLi = oUl.querySelectorAll('li'); | 12 | var aLi = oUl.querySelectorAll('li'); |
@@ -40,8 +47,8 @@ document.addEventListener('DOMContentLoaded', function() { | @@ -40,8 +47,8 @@ document.addEventListener('DOMContentLoaded', function() { | ||
40 | }, false) | 47 | }, false) |
41 | // 删除按钮 | 48 | // 删除按钮 |
42 | aDel[i].index = i; | 49 | aDel[i].index = i; |
43 | - aDel[i].addEventListener('touchstart', function(e) { | ||
44 | - e.preventDefault(); | 50 | + aDel[i].addEventListener('touchstart', function(ev) { |
51 | + ev.preventDefault(); | ||
45 | this.innerHTML = ''; | 52 | this.innerHTML = ''; |
46 | this.style.height = '0'; | 53 | this.style.height = '0'; |
47 | this.style.display = 'none'; | 54 | this.style.display = 'none'; |
@@ -50,14 +57,14 @@ document.addEventListener('DOMContentLoaded', function() { | @@ -50,14 +57,14 @@ document.addEventListener('DOMContentLoaded', function() { | ||
50 | aDiv[this.index].style.height = '0'; | 57 | aDiv[this.index].style.height = '0'; |
51 | aDiv[this.index].style.display = 'none'; | 58 | aDiv[this.index].style.display = 'none'; |
52 | aDiv[this.index].innerHTML = ''; | 59 | aDiv[this.index].innerHTML = ''; |
53 | - this.addEventListener('transitionend', function(e) { | ||
54 | - e.preventDefault(); | 60 | + this.addEventListener('transitionend', function(ev) { |
61 | + ev.preventDefault(); | ||
55 | oUl.removeChild(aLi[this.index]); | 62 | oUl.removeChild(aLi[this.index]); |
56 | }, false) | 63 | }, false) |
57 | }, false); | 64 | }, false); |
58 | aMo[i].index = i; | 65 | aMo[i].index = i; |
59 | - aMo[i].addEventListener('touchstart', function(e) { | ||
60 | - e.preventDefault(); | 66 | + aMo[i].addEventListener('touchstart', function(ev) { |
67 | + ev.preventDefault(); | ||
61 | // var adName = document.querySelectorAll('.ad_conMo'); | 68 | // var adName = document.querySelectorAll('.ad_conMo'); |
62 | $('.ad_conMo').eq(this.index).css('display', 'block').parents('li').siblings().find('.ad_conMo').css('display', 'none') | 69 | $('.ad_conMo').eq(this.index).css('display', 'block').parents('li').siblings().find('.ad_conMo').css('display', 'none') |
63 | 70 |
-
请 注册 或 登录 后发表评论