1/*! 2 * jPushMenu.js 3 * 1.1.1 4 * @author: takien 5 * http://takien.com 6 * Original version (pure JS) is created by Mary Lou http://tympanus.net/ 7 */ 8 9(function($) { 10 11 $.fn.jPushMenu = function(customOptions) { 12 var o = $.extend({}, $.fn.jPushMenu.defaultOptions, customOptions); 13 14 /* add class to the body.*/ 15 16 $('body').addClass(o.bodyClass); 17 $(this).addClass('jPushMenuBtn'); 18 $(this).click(function() { 19 var target = '', 20 push_direction = ''; 21 22 23 if($(this).is('.'+o.showLeftClass)) { 24 target = '.cbp-spmenu-left'; 25 push_direction = 'toright'; 26 } 27 else if($(this).is('.'+o.showRightClass)) { 28 target = '.cbp-spmenu-right'; 29 push_direction = 'toleft'; 30 } 31 else if($(this).is('.'+o.showTopClass)) { 32 target = '.cbp-spmenu-top'; 33 } 34 else if($(this).is('.'+o.showBottomClass)) { 35 target = '.cbp-spmenu-bottom'; 36 } 37 38 39 $(this).toggleClass(o.activeClass); 40 $(target).toggleClass(o.menuOpenClass); 41 42 if($(this).is('.'+o.pushBodyClass)) { 43 $('body').toggleClass( 'cbp-spmenu-push-'+push_direction ); 44 } 45 46 /* disable all other button*/ 47 $('.jPushMenuBtn').not($(this)).toggleClass('disabled'); 48 49 return false; 50 }); 51 var jPushMenu = { 52 close: function (o) { 53 $('.jPushMenuBtn,body,.cbp-spmenu').removeClass('disabled active cbp-spmenu-open cbp-spmenu-push-toleft cbp-spmenu-push-toright'); 54 } 55 } 56 57 if(o.closeOnClickInside) { 58 $(document).click(function() { 59 jPushMenu.close(); 60 }); 61 62 $('.cbp-spmenu,.toggle-menu').click(function(e){ 63 e.stopPropagation(); 64 }); 65 } 66 67 if(o.closeOnClickOutside) { 68 $(document).click(function() { 69 jPushMenu.close(); 70 }); 71 72 $('.cbp-spmenu,.toggle-menu').click(function(e){ 73 e.stopPropagation(); 74 }); 75 } 76 77 // On Click Link 78 if(o.closeOnClickLink) { 79 $('.cbp-spmenu a').on('click',function(){ 80 jPushMenu.close(); 81 }); 82 } 83 }; 84 85 /* in case you want to customize class name, 86 * do not directly edit here, use function parameter when call jPushMenu. 87 */ 88 $.fn.jPushMenu.defaultOptions = { 89 bodyClass : 'cbp-spmenu-push', 90 activeClass : 'menu-active', 91 showLeftClass : 'menu-left', 92 showRightClass : 'menu-right', 93 showTopClass : 'menu-top', 94 showBottomClass : 'menu-bottom', 95 menuOpenClass : 'cbp-spmenu-open', 96 pushBodyClass : 'push-body',
97 closeOnClickOutside: true, 98 closeOnClickInside: true, 99 closeOnClickLink: true 100 }; 101})(jQuery);
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.