PageSourceSearch

https://linklog.link/js/jPushMenu.js

js linklog.link collected 2026-10-09 04:56:26 UTC 3,005 bytes, 94 lines download raw bytes

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        // Close menu on clicking menu link
72       // if (o.closeOnClickLink) {
73           // $('.cbp-spmenu a').on('click',function() {
74              //  jPushMenu.close(o);
75          // });
76      //  }
77    };
78
79   /*
80    * In case you want to customize class name,
81    * do not directly edit here, use function parameter when call jPushMenu.
82    */
83    $.fn.jPushMenu.defaultOptions = {
84        pushBodyClass      : 'push-body',
85        showLeftClass      : 'menu-left',
86        showRightClass     : 'menu-right',
87        showTopClass       : 'menu-top',
88        showBottomClass    : 'menu-bottom',
89        activeClass        : 'menu-active',
90        menuOpenClass      : 'menu-open',
91        closeOnClickOutside: true,
92        closeOnClickLink   : true
93    };
94})(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.