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