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 $.fn.jPushMenu = function(customOptions) { 11 var o = $.extend({}, $.fn.jPushMenu.defaultOptions, customOptions); 12 13 $('body').addClass(o.pushBodyClass); 14 15 // Add class to toggler 16 $(this).addClass('jPushMenuBtn'); 17 18 $(this).click(function(e) { 19 e.stopPropagation(); 20 21 var target = '', 22 push_direction = ''; 23 24 // Determine menu and push direction 25 if ($(this).is('.' + o.showLeftClass)) { 26 target = '.cbp-spmenu-left'; 27 push_direction = 'toright'; 28 } 29 else if ($(this).is('.' + o.showRightClass)) { 30 target = '.cbp-spmenu-right'; 31 push_direction = 'toleft'; 32 } 33 else if ($(this).is('.' + o.showTopClass)) { 34 target = '.cbp-spmenu-top'; 35 } 36 else if ($(this).is('.' + o.showBottomClass)) { 37 target = '.cbp-spmenu-bottom'; 38 } 39 40 if (target == '') { 41 return; 42 } 43 44 $(this).toggleClass(o.activeClass); 45 $(target).toggleClass(o.menuOpenClass); 46 47 if ($(this).is('.' + o.pushBodyClass) && push_direction != '') { 48 $('body').toggleClass(o.pushBodyClass + '-' + push_direction); 49 } 50 51 // Disable all other buttons 52 $('.jPushMenuBtn').not($(this)).toggleClass('disabled'); 53 54 return; 55 }); 56 57 var jPushMenu = { 58 close: function (o) { 59 $('.jPushMenuBtn,body,.cbp-spmenu') 60 .removeClass('disabled ' + o.activeClass + ' ' + o.menuOpenClass + ' ' + o.pushBodyClass + '-toleft ' + o.pushBodyClass + '-toright'); 61 } 62 } 63 64 // Close menu on clicking outside menu 65 /*if (o.closeOnClickOutside) { 66 $(document).click(function() { 67 jPushMenu.close(o); 68 }); 69 }*/ 70 71 //my new script close menu 72 $(window).on('resize', function() { 73 jPushMenu.close(o); 74 }); 75 76 // Close menu on clicking menu link 77 if (o.closeOnClickLink) { 78 $('.cbp-spmenu .level-2 a').on('click',function() { 79 //jPushMenu.close(o); 80 }); 81 } 82 83 // Close menu on clicking menu link 84 if (o.closeOnClickLink) { 85 $('.cbp-spmenu .close-menu').on('click',function(e) { 86 e.preventDefault() 87 jPushMenu.close(o); 88 89 $('.btn-menu-mob').removeClass('is-active'); 90 }); 91 } 92 }; 93 94 /* 95 * In case you want to customize class name, 96 * do not directly edit here, use function parameter when call jPushMenu. 97 */ 98 $.fn.jPushMenu.defaultOptions = { 99 pushBodyClass : 'push-body', 100 showLeftClass : 'menu-left', 101 showRightClass : 'menu-right', 102 showTopClass : 'menu-top', 103 showBottomClass : 'menu-bottom', 104 activeClass : 'menu-active', 105 menuOpenClass : 'menu-open', 106 closeOnClickOutside: true, 107 closeOnClickLink : true 108 }; 109})(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.