Jump to content

Recommended Posts

Hello, I have a navigation bar which opens up a submenu with a mouseover event on pc and with a touch for ios. For ios devices the following code is utilized to close the menu on a touch event to the document.

<script>
document.onclick = mclose(); 
window.addEventListener('load', function (){ // on page load
    document.body.addEventListener('touchstart', function(e){
		if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
		    }, false)
 
}, false)
</script>

My question is - how can I remove the above EventListener from the div displayed as the submenu so that touching within that div does not close it and the links are functional? I am guessing there is a method using preventdefault that may be applied but I am uncertain.

Link to comment
https://forums.phpfreaks.com/topic/295266-remove-touchstart-event-from-menu-div/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.