1Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 2 3(function ($) { 4 Drupal.TBMegaMenu.oldWindowWidth = 0; 5 Drupal.TBMegaMenu.displayedMenuMobile = false; 6 Drupal.TBMegaMenu.supportedScreens = [980]; 7 Drupal.TBMegaMenu.menuResponsive = function () { 8 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 9 var navCollapse = $('.tb-megamenu').children('.nav-collapse'); 10 if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) { 11 navCollapse.addClass('collapse'); 12 if (Drupal.TBMegaMenu.displayedMenuMobile) { 13 navCollapse.css({height: 'auto', overflow: 'visible'}); 14 } else { 15 navCollapse.css({height: 0, overflow: 'hidden'}); 16 } 17 } else { 18 // If width of window is greater than 980 (supported screen). 19 navCollapse.removeClass('collapse'); 20 if (navCollapse.height() <= 0) { 21 navCollapse.css({height: 'auto', overflow: 'visible'}); 22 } 23 } 24 }; 25 26 Drupal.behaviors.tbMegaMenuAction = { 27 attach: function(context) { 28 $('.tb-megamenu-button', context).once('menuIstance', function () { 29 var This = this; 30 $(This).click(function() { 31 if(parseInt($(this).parent().children('.nav-collapse').height())) { 32 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 33 Drupal.TBMegaMenu.displayedMenuMobile = false; 34 } 35 else { 36 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 37 Drupal.TBMegaMenu.displayedMenuMobile = true; 38 } 39 }); 40 }); 41 42 43 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 44 if(!isTouch){ 45 $(document).ready(function($){ 46 var mm_duration = 0; 47 $('.tb-megamenu').each (function(){ 48 if ($(this).data('duration')) { 49 mm_duration = $(this).data('duration'); 50 } 51 }); 52 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 53 $('.nav > li, li.mega').hover(function(event) { 54 var $this = $(this); 55 if ($this.hasClass ('mega')) { 56 $this.addClass ('animating'); 57 clearTimeout ($this.data('animatingTimeout')); 58 $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 59 clearTimeout ($this.data('hoverTimeout')); 60 $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); 61 } else { 62 clearTimeout ($this.data('hoverTimeout')); 63 $this.data('hoverTimeout', 64 setTimeout(function(){$this.addClass ('open')}, 100)); 65 } 66 }, 67 function(event) { 68 var $this = $(this); 69 if ($this.hasClass ('mega')) { 70 $this.addClass ('animating'); 71 clearTimeout ($this.data('animatingTimeout')); 72 $this.data('animatingTimeout', 73 setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 74 clearTimeout ($this.data('hoverTimeout')); 75 $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); 76 } else { 77 clearTimeout ($this.data('hoverTimeout')); 78 $this.data('hoverTimeout', 79 setTimeout(function(){$this.removeClass ('open')}, 100)); 80 } 81 }); 82 }); 83 } 84 85 $(window).resize(function() { 86 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 87 if(windowWidth != Drupal.TBMegaMenu.oldWindowWidth){ 88 Drupal.TBMegaMenu.oldWindowWidth = windowWidth; 89 Drupal.TBMegaMenu.menuResponsive(); 90 } 91 }); 92 }, 93 } 94})(jQuery); 95
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.