Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

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!