Device to ignore one piece of javascript

Conypekneerne

New Member
I am looking to have devices ignore a particular function on my menu. The menu is vertical and is of an accordion nature with sub menus staying open when navigating pages.When it's viewed on devices the menu sits at the top of the page and is smaller. What I need it to do is when the item is clicked, the menu closes again so the menu is not covering the content. Heres the script keeping it open, I guess I'm looking for a if (device) ignore this line...\[code\]<script type="text/javascript">$(function () { $("ul.menu-main > li").hover(function () { //Don't do this again if the same menu is hovered. if (!$(this).hasClass('selected')) { //Ensure any open sub-menu is closed. $("li.selected").children("ul").stop(true, true).slideUp(1000); $("li.selected").removeClass('selected'); //Open sub-menu $(this).addClass('selected'); $(this).children("ul").slideDown(1000); } }); //Keep sub-menu open when navigating pages. if($('.active.parent > ul').length > 0) { $('.active.parent > ul').show(); } }); </script>\[/code\]I need it to ignore this if a device is being used.\[code\]if($('.active.parent > ul').length > 0) { $('.active.parent > ul').show();\[/code\]Hope that makes sense?!
 
Back
Top