jquery - Navbar dropdown disappearing on hover -


on right side of navbar when click on "sign in", spawns dropdown login box, etc. however, when hover on mouse disappears after second.

i can't figure out what's causing or if it's css based...

any appreciated!

_showsubmenu = function(elem, elemid, options, menu, e) {   var menuitem = $(e.currenttarget).find('> a');   var submenu = menuitem.next('.ipsmenu');   $(e.currenttarget).on('mouseleave', _.bind(_hidesubmenu, this, elem, elemid, options, menu));   var itemposition = ips.utils.position.getelemposition(menuitem);   var itemsize = ips.utils.position.getelemdims(menuitem);   var submenusize = ips.utils.position.getelemdims(submenu);   if ($('html').attr('dir') == 'rtl') {     var right = (itemsize.outerwidth - 5);     if ((itemposition.viewportoffset.right + itemsize.outerwidth + submenusize.outerwidth - 5) > $(window).width()) {       if ((itemposition.viewportoffset.right + 5 - submenusize.outerwidth) >= 0) {         right = ((submenusize.outerwidth * -1) + 5);       }     }     submenu.css({       right: right + 'px',       top: (menuitem.position()['top'] - 5) + 'px'     }).show();   } else {     var left = (itemsize.outerwidth - 5);     if ((itemposition.viewportoffset.left + itemsize.outerwidth + submenusize.outerwidth - 5) > $(window).width()) {       if ((itemposition.viewportoffset.left + 5 - submenusize.outerwidth) >= 0) {         left = ((submenusize.outerwidth * -1) + 5);       }     }     submenu.css({       left: left + 'px',       top: (menuitem.position()['top'] - 5) + 'px'     }).show();   } } 

it looks css based. avoid using css hover create functionality (as requires mouse stay on button, or add css adds it)... instead recommend using jquery's toggle feature:

http://www.w3schools.com/jquery/eff_toggle.asp

something like:

$("#signin").click(function(){     $("logindiv").toggle(); });  

should trick.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -