La Crosse USD 395 - LaCrosse High School (2024)

Main Navigation

').appendTo(settings.scope), scopeVal = scopeTest.height(); scopeTest.remove(); return (that / scopeVal).toFixed(8); }; function moveMegaMenu($el, winWidth) { var to = $el.offset(), bottom = to.top + $el.height(), $menu = $el.find('> .dropdown-menu'), mo = $menu.offset(), diff = 0; // If the menu has already been moved, leave if (mo.top == bottom) return false; // Reset the top margin before calculating because breakpoints may have changed menu positions $menu.css('margin-top', ''); mo = $menu.offset(); diff = bottom - mo.top; // Use the top margin of the dropdown menu to "move" it to just below the parent menu $menu.css('margin-top', diff); } function adjustMegaMenuHeight($this) { // A "data" attribute will exist if we've already made this adjustment - if so, leave if ($this.attr('data-height')) return false; // Should the "extra" content use the entire column or share it with the rest of the nav items? var extraShareColumn = false; // Min height for the mega menu in ems var minHeight = 13; // Cache some DOM finds that are used more than once... var $megaMenuExtraContent = $this.find('.mega-menu-extra-content'), $megaMenuExtra = $this.find('.mega-menu-extra'), $megaMenu = $this.find('> .dropdown-menu'); // Will be changed to true if there is "extra" content in the mega menu var extraColumn = false; // Height of the extra column var extraHeight = 0; // How many

    tags are in the mega menu at the 2nd level? // They have a bottom margin (.5em) so they need to be included in the height calculation var ulCount = $this.find('> ul > .dropdown-submenu > ul:visible').length; // How many VISIBLE sections are in the mega menu - all levels var liCount = $this.find('li:visible').length; // Loop through all of the
  • tags and build a total var totalLiHeight = 0, liHeight = 0; $this.find('li:visible').each(function() { liHeight = $(this).find('> a:not(.hidden-sm)').outerHeight(); // IE sometimes returns the wrong height...so reset to a single line at the largest font if (liHeight > 100) liHeight = 27; totalLiHeight += liHeight; }); // If the "extra" content

    is NOT empty, there's an extra column if ( ! $megaMenuExtraContent.is(':empty')) { extraColumn = true; var megaMenuExtraWidth = $megaMenuExtra.outerWidth(true); // Clone the extra content and append it to the body - visible, but off screen so that we can get a RELIABLE height $megaMenuExtra.clone().css({ 'position': 'absolute', 'left': '-99999em', 'width': megaMenuExtraWidth }).appendTo('body'); extraHeight = $('body > .mega-menu-extra').outerHeight(true); // Firefox reporting height 20px shorter than Chrome or IE extraHeight += 20; // Once we have the height, remove the clone $('body > .mega-menu-extra').remove(); // If the "extra" content is sharing the column, add it's height to the

  • total height if (extraShareColumn) totalLiHeight += extraHeight; } // Convert the
  • total height from pixels to ems var calcHeight = $(totalLiHeight).toEm(); // Add the bottom margins for the
      tags to the total calcHeight = parseFloat(calcHeight) + (ulCount / 2); if ( ! extraColumn) { // If the "extra" content is empty, divide by the default 4.25 columns calcHeight /= 4.25; } else { // The "extra" content is NOT empty... // If it's NOT sharing the column, divide by one less column (5 column display - 4.25 "safe" number) if ( ! extraShareColumn) { calcHeight /= 3.25; } else { calcHeight /= 4.25; } } // Convert the extra content height to ems if (extraColumn) extraHeight = parseFloat($(extraHeight).toEm()); var megaMenuHeight = 0; if (calcHeight > minHeight) { megaMenuHeight = calcHeight; } else { megaMenuHeight = minHeight; } if (extraHeight > (megaMenuHeight - 1)) { $megaMenu.css('height', (extraHeight + 1) + 'em'); $megaMenuExtra.css('height', extraHeight + 'em'); // Write the height as a "data" attribute, so we don't do this adjustment more than once $this.attr('data-height', extraHeight); } else { $megaMenu.css('height', megaMenuHeight + 'em'); $this.attr('data-height', megaMenuHeight); if (calcHeight < minHeight || ! extraShareColumn) { $megaMenuExtra.css('height', (megaMenuHeight - 1) + 'em'); } else { if (extraShareColumn) $megaMenuExtraContent.addClass('mega-menu-extra-share'); } } } function addSeeMoreLinks($ul, seeMoreNumber) { // Hide
    • tags beyond the "seeMoreNumber" $ul.find('> li:nth-child(n+ ' + (seeMoreNumber + 1) + ')').addClass('hidden-lg'); // Add "See more..." links to those
        tags where the
      • count has exceeded the "seeMoreNumber". // Those
          tags will have
        • tags with the "hidden-lg" class as a result of the nth-child code above. $ul.each(function() { var $this = $(this); if ($this.find('> li.hidden-lg').length) { // Grab the href from the parent link and use that for the "See more..." link var smhref = $this.prev('a').prop('href'); // Insert it before the first hidden
        • tag $this.find('> li.hidden-lg:first').before('
        • See more...
        • '); } }); } function getSeeMoreTotals($ul, liCount) { var total = 0; if ( ! liCount) return total; if ($ul.length === 1) { total = (liCount > seeMoreNumber) ? seeMoreNumber : liCount; } else { $ul.each(function() { var cnt = $(this).find('> li:visible').length; total += (cnt > seeMoreNumber) ? seeMoreNumber : cnt; }); } return total; } function fillMegaMenu($this) { // Only want to do this if the config entry > 0 if (megaMenuMin <= 0) return false; // Only want to do this work once per top-level menu, so if it has already been "filled", leave if ($this.hasClass('socs-mm-filled')) return false; $this.addClass('socs-mm-filled'); // Get the number of visible
        • and
            tags at each level within the mega menu var liLevel1 = $this.find('> .dropdown-menu > li:visible').length, liLevel2 = $this.find('> ul > .dropdown-submenu > ul > li:visible').length, liLevel3 = $this.find('> ul ul ul li:visible').length, $ulLevel2 = $this.find('> ul > .dropdown-submenu > ul:visible'), $ulLevel3 = $this.find('> ul ul ul:visible'); // How many visible items are in the mega menu - all levels// var liTotal = $this.find('li:visible').length; var liTotal = liLevel1 + liLevel2 + liLevel3;/*console.log('-------------------------------');console.log('liLevel1 = ' + liLevel1);console.log('liLevel2 = ' + liLevel2);console.log('liLevel3 = ' + liLevel3);console.log('liTotal = ' + liTotal);console.log('ulLevel2 = ' + $ulLevel2.length);console.log('ulLevel3 = ' + $ulLevel3.length);*/ // Short-circuit if ALL of the items will fit or there aren't any 2nd level items if (liTotal <= megaMenuMax || liLevel2 === 0) return false; // 1st level items >= the min - hide 2nd and 3rd level items and leave if (liLevel1 >= megaMenuMin) { $this.find('> ul ul').addClass('socs-mm-hide'); return false; } // The "seeMoreNumber" may limit the number of
          • tags that are visible within each
              at the 2nd and 3rd levels // Total
            • tags at 2nd and 3rd level AFTER the "seeMoreNumber" limit has been applied on each
                var liLevel2SeeMore = getSeeMoreTotals($ulLevel2, liLevel2); var liLevel3SeeMore = getSeeMoreTotals($ulLevel3, liLevel3);/*console.log('liLevel2SeeMore = ' + liLevel2SeeMore);console.log('liLevel3SeeMore = ' + liLevel3SeeMore);console.log('fillMegaMenu - doing the work');*/ var showAllLevel2 = ((liLevel1 + liLevel2) <= megaMenuMax) ? true : false; var showReducedLevel2 = ((liLevel1 + liLevel2SeeMore) <= megaMenuMax) ? true : false; // If 2nd level won't fit under the max (all or reduced) - hide 2nd and 3rd level items and leave if ( ! showReducedLevel2) { $this.find('> ul ul').addClass('socs-mm-hide'); return false; } // If all 2nd level won't fit but the reduced 2nd level will... if ( ! showAllLevel2 && showReducedLevel2) addSeeMoreLinks($ulLevel2, seeMoreNumber); // Are there any 3rd level items? if (liLevel3) { // Which 2nd level number was used? Use it for 3rd level calculations var liLevel2Used = liLevel2SeeMore; if (showAllLevel2) liLevel2Used = liLevel2; var showAllLevel3 = ((liLevel1 + liLevel2Used + liLevel3) <= megaMenuMax) ? true : false; var showReducedLevel3 = ((liLevel1 + liLevel2Used + liLevel3SeeMore) <= megaMenuMax) ? true : false; // If 3rd level won't fit under the max (all or reduced) - hide 3rd level items and leave if ( ! showReducedLevel3) { $ulLevel3.addClass('socs-mm-hide'); return false; } // If all 3rd level won't fit but the reduced 3rd level will... if ( ! showAllLevel3 && showReducedLevel3) addSeeMoreLinks($ulLevel3, seeMoreNumber); } } function clearMenus() { // Remove the "open" class from all dropdowns and reset all aria attributes $('#navbar .open, .sub-nav-wrap1 .open').removeClass('open keyboard-open'); $('#navbar [aria-expanded], .sub-nav-wrap1 [aria-expanded]').attr('aria-expanded', 'false'); $('#navbar [aria-hidden], .sub-nav-wrap1 [aria-hidden]').attr('aria-hidden', 'true'); } var megaMenuMin = parseInt($('#megaMenuMin').val() || 0), megaMenuMax = parseInt($('#megaMenuMax').val() || 0), seeMoreNumber = parseInt($('#seeMoreNumber').val() || 999);/*console.log('megaMenuMin = ' + megaMenuMin);console.log('megaMenuMax = ' + megaMenuMax);console.log('seeMoreNumber = ' + seeMoreNumber);*/ // Some mega menu work needs to be done each time it's displayed. $('.socs-mm-fw').on('mouseenter', function (e) { var $this = $(this), winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; // Only want to do the following in the "lg" breakpoint (min-width: 1200px); if (winWidth < 1200) { // If NOT in the "lg" breakpoint, reset the top margin and height, then leave $this.find('> .dropdown-menu').css({ 'margin-top': '', 'height': '' }); return false; } // Hide the mega menu "extra column" if empty if ($this.find('.mega-menu-extra-content').is(':empty')) $this.find('.mega-menu-extra').addClass('hidden'); // A navbar that spans multiple rows causes problems for the mega menu moveMegaMenu($this, winWidth); fillMegaMenu($this); // Adjust the height of the mega menu based on the content to be displayed in it. adjustMegaMenuHeight($this); }); $(function() { // Keyboard activity ------------------------------------------------------ $('#navbar, .sub-nav-wrap1').on('keydown', '.dropdown-submenu > a[aria-haspopup], .dropdown > a[aria-haspopup]', function(e) { // Watch for the ENTER key var keyCode = e.keyCode || e.which; if (keyCode == 13) { var $liParent = $(this).parent(); // Toggle "open" class on "dropdown" elements if ($liParent.hasClass('keyboard-open')) { if ($liParent.closest('#navbar').length) { $liParent.removeClass('keyboard-open open'); } else { $liParent.removeClass('keyboard-open'); } // Change aria attributes $(this).attr('aria-expanded', 'false').next().attr('aria-expanded', 'false').attr('aria-hidden', 'true'); } else { if ($liParent.closest('#navbar').length) { $liParent.addClass('keyboard-open open'); } else { $liParent.addClass('keyboard-open'); } // Change aria attributes $(this).attr('aria-expanded', 'true').next().attr('aria-expanded', 'true').attr('aria-hidden', 'false'); } // Prevent browser from following link - this link will act as a toggle for displaying/hiding the dropdown e.preventDefault(); } }); // Close any previously opened dropdown menus as the user tabs to a new 1st-level navbar item $('#navbar, .sub-nav-wrap1').on('focus', '.nav > li > a', function(e) { if ( ! $(this).parent().hasClass('open')) clearMenus(); }); // Close any previous opened flyout menu as the user tabs to a new 2nd-level navbar item $('#navbar').on('focus', '.dropdown-menu > li > a', function(e) { if ( ! $(this).parent().hasClass('open')) { $(this) .parent().parent().find('> li').removeClass('open keyboard-open') .children('a[aria-expanded]').attr('aria-expanded', 'false').next().attr('aria-expanded', 'false').attr('aria-hidden', 'true'); } }); // Close open dropdowns when tabbing out of them (tabbing "forward") $('.sub-nav-wrap1').on('blur', '.dropdown-menu > li:last-child > a', function(e) { var x = e.relatedTarget ? e.relatedTarget : document.activeElement; if ($(x).closest('.dropdown-submenu.open').length === 0) clearMenus(); }); // Shift-tabbing (tabbing "backward") $('.sub-nav-wrap1').on('blur', '.dropdown-submenu.open > a', function(e) { var x = e.relatedTarget ? e.relatedTarget : document.activeElement; if ($(e.target).parent().hasClass('open')) { if ($(x).closest('.dropdown-submenu.open').length === 0) clearMenus(); } }); $('html').on('click keydown', function(e) { if (e.type === 'click') { // Close the menu when clicking "outside" the menu... if ($(e.target).closest('.dropdown-submenu.open').length === 0) clearMenus(); } else { // Close any open menus if the ESCAPE key is pressed var keyCode = e.keyCode || e.which; if (keyCode == 27) clearMenus(); } }); // Hover activity --------------------------------------------------------- // Close any keyboard "opened" menus when the mouse enters the navbar $('#navbar, .sub-nav-wrap1').on('mouseenter', function(e) { if ($('#navbar .keyboard-open').length || $('.sub-nav-wrap1 .dropdown-submenu.open').length) clearMenus(); }); // Change aria attribute values when mouse enters/leaves dropdown targets $('#navbar, .sub-nav-wrap1').on('mouseenter', '.dropdown, .dropdown-submenu', function(e) { $(this).children('a[aria-expanded]').attr('aria-expanded', 'true').next().attr('aria-expanded', 'true').attr('aria-hidden', 'false'); }); $('#navbar, .sub-nav-wrap1').on('mouseleave', '.dropdown, .dropdown-submenu', function(e) { $(this).children('a[aria-expanded]').attr('aria-expanded', 'false').next().attr('aria-expanded', 'false').attr('aria-hidden', 'true'); }); });})(jQuery);
La Crosse USD 395 - LaCrosse High School (2024)
Top Articles
Latest Posts
Article information

Author: Patricia Veum II

Last Updated:

Views: 6107

Rating: 4.3 / 5 (64 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.