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