1/*! Pushy - v0.9.2 - 2014-9-13 2* Pushy is a responsive off-canvas navigation menu using CSS transforms & transitions. 3* https://github.com/christophery/pushy/ 4* by Christopher Yee */ 5 6jQuery(function() { 7 var pushy = jQuery('.pushy'), //menu css class 8 body = jQuery('body'), 9 push = jQuery('.push'), //css class to add pushy capability 10 siteOverlay = jQuery('.site-overlay'), //site overlay 11 pushyClass = "pushy-left pushy-open", //menu position & menu open class 12 pushyActiveClass = "pushy-active", //css class to toggle site overlay 13 pushClass = "push-push", //css class to add pushy capability 14 menuBtn = jQuery('.menu-btn, .pushy a'), //css classes to toggle the menu 15 menuSpeed = 200, //jQuery fallback menu speed 16 menuWidth = pushy.width() + "px"; //jQuery fallback menu width 17 18 function togglePushy(){ 19 body.toggleClass(pushyActiveClass); //toggle site overlay 20 pushy.toggleClass(pushyClass); 21 push.toggleClass(pushClass); //css class to add pushy capability 22 } 23 24 function openPushyFallback(){ 25 body.addClass(pushyActiveClass); 26 pushy.animate({left: "0px"}, menuSpeed); 27 push.animate({left: menuWidth}, menuSpeed); //css class to add pushy capability 28 } 29 30 function closePushyFallback(){ 31 body.removeClass(pushyActiveClass); 32 pushy.animate({left: "-" + menuWidth}, menuSpeed); 33 push.animate({left: "0px"}, menuSpeed); //css class to add pushy capability 34 } 35 36 //checks if 3d transforms are supported removing the modernizr dependency 37 cssTransforms3d = (function csstransforms3d(){ 38 var el = document.createElement('p'), 39 supported = false, 40 transforms = { 41 'webkitTransform':'-webkit-transform', 42 'OTransform':'-o-transform', 43 'msTransform':'-ms-transform', 44 'MozTransform':'-moz-transform', 45 'transform':'transform' 46 }; 47 48 // Add it to the body to get the computed style 49 document.body.insertBefore(el, null); 50 51 for(var t in transforms){ 52 if( el.style[t] !== undefined ){ 53 el.style[t] = 'translate3d(1px,1px,1px)'; 54 supported = window.getComputedStyle(el).getPropertyValue(transforms[t]); 55 } 56 } 57 58 document.body.removeChild(el); 59 60 return (supported !== undefined && supported.length > 0 && supported !== "none"); 61 })(); 62 63 if(cssTransforms3d){ 64 //toggle menu 65 menuBtn.click(function() { 66 togglePushy(); 67 }); 68 //close menu when clicking site overlay 69 siteOverlay.click(function(){ 70 togglePushy(); 71 }); 72 }else{ 73 //jQuery fallback 74 pushy.css({left: "-" + menuWidth}); //hide menu by default 75 76 //keep track of menu state (open/close) 77 var state = true; 78 79 //toggle menu 80 menuBtn.click(function() { 81 if (state) { 82 openPushyFallback(); 83 state = false; 84 } else { 85 closePushyFallback(); 86 state = true; 87 } 88 }); 89 90 //close menu when clicking site overlay 91 siteOverlay.click(function(){ 92 if (state) { 93 openPushyFallback(); 94 state = false; 95 } else { 96 closePushyFallback(); 97 state = true; 98 } 99 }); 100 } 101});
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.