1jQuery(function() { 2 3 jQuery('#smart-navi').click(function(){ 4 jQuery('#header .mod_navigation .level_1').toggleClass('active'); 5 return false; 6 }); 7 8 // see whether device supports touch events (a bit simplistic, but...) 9 var hasTouch = ("ontouchstart" in window); 10 var iOS5 = /iPad|iPod|iPhone/.test(navigator.platform) && "matchMedia" in window; 11 12 // hook touch events for drop-down menus 13 // NB: if has touch events, then has standards event handling too 14 // but we don't want to run this code on iOS5+ 15 if (hasTouch && document.querySelectorAll && !iOS5) { 16 var i, len, element, 17 dropdowns = document.querySelectorAll("#header .mod_navigation li > a.submenu"); 18 19 function menuTouch(event) { 20 // toggle flag for preventing click for this link 21 var i, len, noclick = !(this.dataNoclick); 22 23 // reset flag on all links 24 for (i = 0, len = dropdowns.length; i < len; ++i) { 25 dropdowns[i].dataNoclick = false; 26 } 27 28 // set new flag value and focus on dropdown menu 29 this.dataNoclick = noclick; 30 this.focus(); 31 } 32 33 function menuClick(event) { 34 // if click isn't wanted, prevent it 35 if (this.dataNoclick) { 36 event.preventDefault(); 37 } 38 } 39 40 for (i = 0, len = dropdowns.length; i < len; ++i) { 41 element = dropdowns[i]; 42 element.dataNoclick = false; 43 element.addEventListener("touchstart", menuTouch, false); 44 element.addEventListener("click", menuClick, false); 45 } 46 47 48 49 50 } 51 52 53});
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.