开发者

onClick listener for touch screens and tablets

I have a bunch of click listeners in my jquery and was wondering what I need to do to get them to work on mobile devices and touch screens? So if my code is...

$(el).bind('click', function () {
    //my event function
});

d开发者_开发问答o I need to do like...

$(el).bind('click, touch', function () {
    //my event function
});


Use jQuery mobile. It has events exactly for touchscreens and tablets: tap, taphold etc


click is perfectly handled on touch devices as a tap, so you don't need to do anything.

The touch device specific events are swipe and such.


If you get click events on regular devices you also get click events on mobile devices when "clicking" them on the touch screen.

You only need special events if you want to support advanced touchscreen/multitouch-related features.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜