jquery - Slicknav: how to close menu when clicking outside -



jquery - Slicknav: how to close menu when clicking outside -

i using slicknav jquery plugin, seems auto-closing menu on blur or lost focus not set default , there no setting it.

i thought simple phone call this:

<script> $(document).ready(function() { //close menu on lost focus $('.js .slicknav_menu').focusout(function(event){ $(this).slicknav('close'); }); }); </script>

but doesn't anything. how close menu when clicking outside of menu?

i referred site mentioned in question. tried first illustration given in site. (html code of given below)

html -

<ul id="menu"> <li><a class="scroll" href="#features">features</a></li> <li><a class="scroll" href="#usage">usage instructions</a></li> <li><a class="scroll" href="#examples">examples</a></li> <li><a href="http://github.com">view on github</a></li> </ul>

i saw menu not closing default on lost focus event. below code worked accomplish same.

$(document).ready(function() { //close menu on lost focus $('.slicknav_menu').focusout(function(event){ $('#menu').slicknav('close'); //here 'menu' id of ul. }); });

jquery mobile slicknav

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -