Javascript Events are not working in Tablet-pc?

前端 未结 3 1970
隐瞒了意图╮
隐瞒了意图╮ 2021-01-18 20:09

I have developed a web application in asp.net 3.5. It is consuming lot of javascript/JQuery events and working properly in normal browser in pc, but my client is saying that

相关标签:
3条回答
  • 2021-01-18 20:25

    You can use a combination and try touchstart instead of tap

    ('myelement').bind('touchstart click', function(event){
       myClickFunction();   
    });
    
    0 讨论(0)
  • 2021-01-18 20:45

    There are touch events for a touch screen device:

    touchstart: a finger is placed on a DOM element.
    touchmove: a finger is dragged along a DOM element.
    touchend: a finger is removed from a DOM element.
    

    Maybe you want to try working with those. That being said, it is good to use events like change (or onchange inline with the element) for a drop down list because it is will work no matter what changes it (keyboard, mouse event or touch event).

    Here is a resource to learn more.

    0 讨论(0)
  • 2021-01-18 20:46

    The click events won't work on the iPad as it is touch screen - click vs touch I guess. Have you considered using JQueryMobile rather than JQuery? I is optimised for touch devices - as it states on the very front page of the site.

    Rather than using click it has a whole host of events you can hook into i.e. tap, swipe, taphold etc... It would be easy enough to hook the same function into a click and a tap event i.e.

    ('myelement').bind('click', function(event){
       myClickFunction();   
    });
    
    ('myelement').bind('tap', function(event){
       myClickFunction();   
    });
    

    There are possibly (almost certainly) more elegant ways to do this - but that's just a start really.

    0 讨论(0)
提交回复
热议问题