javascript - My script only works on desktop not mobile devices.. can you tell me why? -
this question has answer here:
here script use on html page hide , show divs depending on user clicks.
<script> $(document).ready(function(){ $("#sollink").click(function(){ $(".segslide").hide(), $(".eduslide").hide(), $(".solslide").show(), $(".startover").show(); }); $("#seglink").click(function(){ $(".solslide").hide(), $(".eduslide").hide(), $(".segslide").show(), $(".startover").show(); }); $("#edulink").click(function(){ $(".solslide").hide(), $(".segslide").hide(), $(".eduslide").show(), $(".startover").show(); }); }); </script>
it works on desktop browsers, when try on iphone not hide/show divs. showing seems.
you need use touch events mobile devices. click events registered mouse mobile devices smartphones , tablets not.
try along these lines:
$(document).on('click touchstart', function () { // code here ... }
there multiple touch events example above may not exact event need, here w3c list of touch events.
Comments
Post a Comment