Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Year Menu elements being hidden #22

Closed
demetrios-koziris opened this issue May 2, 2017 · 1 comment
Closed

Year Menu elements being hidden #22

demetrios-koziris opened this issue May 2, 2017 · 1 comment
Assignees

Comments

@demetrios-koziris
Copy link
Owner

demetrios-koziris commented May 2, 2017

All mcen-yearMenuItemLI elements are having the following style attribute applied to them:
display: none;

This seems to be due to Drupal behavior for hiding overflowing items from a menu:

  /**
   * If menu is too wide for one line, hide overflowing items.
   */
  Drupal.behaviors.longMainMenu = {

    attach: function( context ) {

      var longMenuEl = $( ".sf-main-menu > li.first" );

      /*
       * Page loads completely before measuring which menu items are on the line.
       * If other menu items are displayed below (i.e. in second line) hide
       * them.
       */
      setTimeout(function(){

        // Execute only if menu has more than one item.
        if ( longMenuEl.length > 0 ) {

          // Get top position of regular menu items
          var topLocation = longMenuEl.position().top;

          // Make sure loop has only run once.
          var hasLooped = false;

          if(!hasLooped) {

            $( ".sf-main-menu > li" ).each( function() {

                if ( $( this ).position().top != topLocation ) {
                  $( this ).hide();
                }
            });

            // Prevents multiple loops.
            hasLooped = true;
          }
        }
      }, 800);
    }
  };

source: https://www.mcgill.ca/study/2014-2015/files/study.2014-2015/js/js_1ElH_15kX_bq7jptFK0fLDW6Ljruj1633N7OWPR3e_4.js

The hide function is defined as follows:

hide: function(a, b, c) {
            if (a || a === 0) return this.animate(cc("hide", 3), a, b, c);
            for (var e = 0, f = this.length; e < f; e++) {
                var g = d.css(this[e], "display");
                g !== "none" && !d._data(this[e], "olddisplay") && d._data(this[e], "olddisplay", g)
            }
            for (e = 0; e < f; e++) this[e].style.display = "none";
            return this
        },

source: https://www.mcgill.ca/study/2014-2015/sites/all/libraries/modernizr/modernizr.js?opa6td

@demetrios-koziris
Copy link
Owner Author

Can resolve by not using the sf-main-menu class for the year menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant