Skip to main content

Town of Arlington, Town Bylaws, Title VIII (Public Health and Safety)

Citation
Town of Arlington, Town Bylaws, Title VIII (Public Health and Safety)
Jurisdiction
Arlington (municipal)
Source
Official source

Related Parts of This Source

Full Text

1,729 chars
/**********************************************************
Dropdown Menu delay disappearance on mouse out
*********************************************************/
/*javascript to delay the disappearance of the menu when the user mouses out. Uses jquery library.*/
$(function () {

var timer = null;
var delay = 800; //change this number for shorter or longer delay

//using megamenu
var dropdowncontainer = '>.megamenu_container';
var activePage = $(".mainnav .dropdownmenu > li.active");
$('.mainnav > .dropdownmenu>li > a').css('overflow', 'visible');
$(".mainnav > .dropdownmenu > li").hoverIntent(

//what happens on hover over
function () {
//end timer and stop hiding if they are mousing back in.
if (timer != null) {
clearTimeout(timer);
timer = null;
}
// Find the hovered menu's sub-menu
var $menu = $(this);
var $submenu = $(this).find(dropdowncontainer);

// hide any other submenus that are open
$('.mainnav > .dropdownmenu>li' + dropdowncontainer).not($submenu).css('display', 'none');
$('.mainnav > .dropdownmenu li.active').not($menu).not(activePage).removeClass('active');
$('.mainnav > .dropdownmenu li._visionMenuHovered').not($menu).removeClass('_visionMenuHovered');
// show current menu
$submenu.css('display', 'block');
$menu.addClass('active');
$menu.addClass('_visionMenuHovered');
},

//what happens on mouse out
function () {
var $submenu = $(this).find(dropdowncontainer);
var $menu = $(this);
// delay disappearance
var mouseDelay = $(this).data("mouseDelay") || delay;
clearTimeout(timer);
timer = setTimeout(function () {
$submenu.css('display', 'none'); $menu.not(activePage).removeClass('active');
$menu.removeClass('_visionMenuHovered');
clearTimeout(timer); timer = null;
}, mouseDelay);
}
);