Reply To: Expand on hover when collapsed

Home Forums Older releases 0.9.x Expand on hover when collapsed Reply To: Expand on hover when collapsed

#2277
admin
Keymaster

No problem at all! To make the toggle button work on hover too, you can use some additional JS like this:

$(function() {
	var menuHideTimer = 0,
		$menuBtn = $('#menu-button'),
		$menu = $('#main-menu');
	function hideDelayed() {
		clearHideTimer();
		if ($menu.is(':visible')) {
			menuHideTimer = setTimeout(function() {
				$menu.smartmenus('menuHideAll');
				$menuBtn.click();
			}, 500);
		}
	}
	function clearHideTimer() {
		if (menuHideTimer) {
			clearTimeout(menuHideTimer);
			menuHideTimer = 0;
		}
	}
	$menuBtn.bind({
		'mouseenter': function() {
			clearHideTimer();
			if (!$menu.is(':visible')) {
				$menuBtn.click();
			}
		},
		'mouseleave': hideDelayed
	});
	$menu.bind({
		'mouseenter': clearHideTimer,
		'mouseleave': hideDelayed
	});
});

Cheers!

Register

You will be emailed a link to set your password.

Login

Lost password?