mam tego jQuery plugin:
$.fn.touchBind = function(func) {
$(this).live('touchmove', function() {
$(this).addClass('dragged');
});
$(this).live('touchend', function() {
if ($(this).hasClass('dragged') == false) {
func();
}
});
return this;
}
i nazwać tak:
$('.the-element').touchBind(function() {
$(this).hide();
});
Moim problemem jest to, że $(this)
w $(this).hide()
nie odnosi się do $('.the-element')
, ale raczej DOMWindow
. Czy jest sposób, w jaki mogę to wykonać?
Jestem świadomy, że mogę to zrobić, po prostu nie zachowuje się jak normalna wtyczka jQuery. Lubię używać '$ (this)'. – clem