Authored by xuqi

fastclick处理点击事件

@@ -19,7 +19,8 @@ @@ -19,7 +19,8 @@
19 "lazyload": "1.9.5", 19 "lazyload": "1.9.5",
20 "iscroll": "5.1.2", 20 "iscroll": "5.1.2",
21 "mustache": "2.0.0", 21 "mustache": "2.0.0",
22 - "underscore": "1.6.0" 22 + "underscore": "1.6.0",
  23 + "fastclick": "1.0.2"
23 }, 24 },
24 "devDependencies": { 25 "devDependencies": {
25 "expect.js": "0.3.1" 26 "expect.js": "0.3.1"
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 Mustache = require('mustache'), 8 Mustache = require('mustache'),
  9 + Fastclick = require('fastclick'),
9 ellipsis = require('mlellipsis'); 10 ellipsis = require('mlellipsis');
10 11
11 require('lazyload'); 12 require('lazyload');
@@ -27,6 +28,9 @@ exports.init = function() { @@ -27,6 +28,9 @@ exports.init = function() {
27 canScroll = true, 28 canScroll = true,
28 tpl; 29 tpl;
29 30
  31 + //fastclick
  32 + Fastclick(document.body);
  33 +
30 //获取相关资讯模板 34 //获取相关资讯模板
31 $.get('/ps/readTpl', function(data) { 35 $.get('/ps/readTpl', function(data) {
32 if (data.success) { 36 if (data.success) {
@@ -56,10 +60,7 @@ exports.init = function() { @@ -56,10 +60,7 @@ exports.init = function() {
56 $('#more-intro .more').css('visibility', 'hidden'); 60 $('#more-intro .more').css('visibility', 'hidden');
57 } 61 }
58 62
59 - $('#more-intro').delegate('.more', 'touchstart', function(e) {  
60 - e.preventDefault();  
61 - showMoreIntro();  
62 - }).delegate('.more', 'click', function() { 63 + $('#more-intro').delegate('.more', 'click', function() {
63 showMoreIntro(); 64 showMoreIntro();
64 }); 65 });
65 66
@@ -3,7 +3,8 @@ @@ -3,7 +3,8 @@
3 * @author: xuqi(qi.xu@yoho.cn) 3 * @author: xuqi(qi.xu@yoho.cn)
4 * @date;2015/3/30 4 * @date;2015/3/30
5 */ 5 */
6 -var $ = require('jquery'); 6 +var $ = require('jquery'),
  7 + Fastclick = require('fastclick');
7 require('lazyload'); 8 require('lazyload');
8 9
9 /** 10 /**
@@ -20,6 +21,9 @@ exports.init = function() { @@ -20,6 +21,9 @@ exports.init = function() {
20 containerH, 21 containerH,
21 containerTop; 22 containerTop;
22 23
  24 + //fastclick
  25 + Fastclick(document.body);
  26 +
23 /** 27 /**
24 * 计算小箭头位置函数 28 * 计算小箭头位置函数
25 * @param index(类型为number,调用函数li的index) 29 * @param index(类型为number,调用函数li的index)
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 _ = require('underscore'), 8 _ = require('underscore'),
9 Mustache = require('mustache'), 9 Mustache = require('mustache'),
  10 + Fastclick = require('fastclick'),
10 timer = null; 11 timer = null;
11 12
12 require('lazyload'); 13 require('lazyload');
@@ -64,6 +65,9 @@ exports.init = function() { @@ -64,6 +65,9 @@ exports.init = function() {
64 //加载更多 65 //加载更多
65 var winH = $(window).height(); 66 var winH = $(window).height();
66 67
  68 + //fastclick
  69 + Fastclick(document.body);
  70 +
67 //read good-info template 71 //read good-info template
68 $.get('/tpl/readTpl', function(data) { 72 $.get('/tpl/readTpl', function(data) {
69 if (data.success) { 73 if (data.success) {
@@ -270,10 +274,7 @@ exports.init = function() { @@ -270,10 +274,7 @@ exports.init = function() {
270 } 274 }
271 275
272 //切换“最新”,“销量”,“价格”以及“筛选”功能 276 //切换“最新”,“销量”,“价格”以及“筛选”功能
273 - $('#goods-nav').delegate('.nav-item', 'touchstart', function(e) {  
274 - e.preventDefault();  
275 - navTouchEvt(e);  
276 - }).delegate('.nav-item', 'click', function(e) { 277 + $('#goods-nav').delegate('.nav-item', 'click', function(e) {
277 navTouchEvt(e); 278 navTouchEvt(e);
278 }); 279 });
279 280
@@ -301,10 +302,7 @@ exports.init = function() { @@ -301,10 +302,7 @@ exports.init = function() {
301 $('#sub-' + curType).removeClass('hide'); 302 $('#sub-' + curType).removeClass('hide');
302 } 303 }
303 304
304 - $('#screen-content').delegate('.c-item', 'touchstart', function(e) {  
305 - e.preventDefault();  
306 - scTouchEvt(e);  
307 - }).delegate('.c-item', 'click', function(e) { 305 + $('#screen-content').delegate('.c-item', 'click', function(e) {
308 scTouchEvt(e); 306 scTouchEvt(e);
309 }); 307 });
310 308
@@ -4,6 +4,7 @@ $pxConvertRem : 40; @@ -4,6 +4,7 @@ $pxConvertRem : 40;
4 body { 4 body {
5 font-family: helvetica,Arial,"黑体"; 5 font-family: helvetica,Arial,"黑体";
6 background: #f0f0f0; 6 background: #f0f0f0;
  7 + -webkit-tap-highlight-color: rgba(0,0,0,0);
7 } 8 }
8 9
9 ol, ul { 10 ol, ul {
@@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
192 > div { 192 > div {
193 height: 30rem / $pxConvertRem; 193 height: 30rem / $pxConvertRem;
194 width: 30rem / $pxConvertRem; 194 width: 30rem / $pxConvertRem;
195 - border: 2px solid #f00; 195 + border: 2px solid #000;
196 border-bottom-color: transparent; 196 border-bottom-color: transparent;
197 } 197 }
198 } 198 }
1 @import "common/common", "common/brands", "common/good-info"; 1 @import "common/common", "common/brands", "common/good-info";
2 2
3 -body {  
4 - background-color: #f0f0f0;  
5 -}  
6 -  
7 .template-container .tpl-block:first-child { 3 .template-container .tpl-block:first-child {
8 border-top: none; 4 border-top: none;
9 } 5 }