Click on iOs and Android


/ Published in: JavaScript

Here is a code that force to fire a click on iOS devices, where there is first a touchstart event


Copy this code and paste it in your HTML
  1. var UA = navigator.userAgent,
  2. iOS = !!(UA.match(/iPad|iPhone|Android/i));
  3. $(this).on("click", function(){
  4. // do somthing
  5. });
  6. if (iOS) {
  7. $(document).on('touchstart', function (e) {
  8. e.target.click();
  9. });
  10. }

URL: https://stackoverflow.com/questions/10577906/how-to-make-my-click-function-work-with-ios#answer-41984774

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.