PageSourceSearch

https://lsst.org/sites/all/modules/tb_megamenu/js/tb-megamenu-touch.js?soc7tq

js lsst.org collected 2026-09-24 09:06:37 UTC 1,717 bytes, 55 lines download raw bytes

1Drupal.TBMegaMenu = Drupal.TBMegaMenu || {};
2
3(function ($) {
4  Drupal.TBMegaMenu.createTouchMenu = function(items) {
5    items.children('a').each( function() {
6      var $item = $(this);
7      var tbitem = $(this).parent();
8
9      $item.click( function(event){
10        if ($item.hasClass('tb-megamenu-clicked')) {
11          var $uri = $item.attr('href');
12          window.location.href = $uri;
13        }
14        else {
15          event.preventDefault();
16          $item.addClass('tb-megamenu-clicked');
17          if(!tbitem.hasClass('open')){	
18            tbitem.addClass('open');
19          }
20
21          $('body').addClass('tb-megamenu-open');
22        }
23      });
24    });
25  }
26  
27  Drupal.TBMegaMenu.eventStopPropagation = function(event) {
28    if (event.stopPropagation) {
29      event.stopPropagation();
30    }
31    else if (window.event) {
32      window.event.cancelBubble = true;
33    }
34  }
35
36  Drupal.behaviors.tbMegaMenuTouchAction = {
37    attach: function(context) {
38      var isTouch = window.matchMedia('(pointer: coarse)').matches;
39      if(isTouch){
40        $('html').addClass('touch');
41        Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu'));
42
43        // When the user touches anywhere outside of the open menu item, close
44        // the open menu item.
45        $(document).on('touchstart', function(event) {
46          if ($('body').hasClass('tb-megamenu-open') && !$(event.target).closest('.mega.open').length) {
47            $('.tb-megamenu ul.nav li.mega a').removeClass('tb-megamenu-clicked');
48            $('.tb-megamenu ul.nav li.mega').removeClass('open');
49            $('body').removeClass('tb-megamenu-open');
50         }
51       });
52      }
53    }
54  }
55})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.