$.fn.longPress = function(fn) {
var timeout = undefined;
var $temThis = this;
//var $(this) = this;
for(var i = 0;i<$temThis.length;i++){
$temThis[i].addEventListener('touchstart', function(event) {
timeout = setTimeout(fn, 800);
}, false);
$temThis[i].addEventListener('touchend', function(event) {
clearTimeout(timeout);
}, false);
}
return this;
}
$('.common-get-input').longPress(function(){
$(this).hide();//这里的this不能指向我想要的?请问怎么解决?
console.log('changan');
});
这里的this不能指向我想要的?请问怎么解决?
哈士奇WWW
相关分类