rafique12
asked on
jQuery touch to .Open and .Close
Hi people,
Does anyone know how to replicate the hover function on touch devices?
I am able to open a dropdown menu with touch but I can seem to get it to close when touched!
Any able to point me in the right direction will be much appreciated...
Does anyone know how to replicate the hover function on touch devices?
I am able to open a dropdown menu with touch but I can seem to get it to close when touched!
<script>
<-- Below opens the dropdown -->
jQuery('.dropdown-toggle').on('touchstart', function(e) {
e.stopPropagation();
var dropdown = jQuery(this).open(".dropdown-menu");
<-- Now I am trying to close on touch -->
jQuery('.dropdown-toggle').on('touchstart', function(e) {
e.stopPropagation();
var dropdown = jQuery(this).removeclass(".open");
});
});
</script>
Any able to point me in the right direction will be much appreciated...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the contributions guys!
But I've not been able to use touch to close using either of the above methods^
But I've not been able to use touch to close using either of the above methods^
Then maybe you should post a link instead of expecting a solution when all you have given us is a fragment of code with no context.
Cd&
Cd&
Same as JQuery library are you sure that you have jQuery mobile library loaded to the site too (http://jquerymobile.com/)?
ASKER
^The link is dead, but yes I have it loaded.
Thanks for the response though!
Thanks for the response though!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for not closing this sooner
$("a").live("touchstart", function(e) {
$(this).trigger("hover");
});
Cd&