PageSourceSearch

https://my-seki.com/plugins/system/t3/base/js/off-canvas.js

js my-seki.com collected 2026-10-09 23:51:11 UTC 4,351 bytes, 155 lines download raw bytes

1/**
2 *------------------------------------------------------------------------------
3 * @package       T3 Framework for Joomla!
4 *------------------------------------------------------------------------------
5 * @copyright     Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved.
6 * @license       GNU General Public License version 2 or later; see LICENSE.txt
7 * @authors       JoomlArt, JoomlaBamboo, (contribute to this project at github
8 *                & Google group to become co-author)
9 * @Google group: https://groups.google.com/forum/#!forum/t3fw
10 * @Link:         http://t3-framework.org
11 *------------------------------------------------------------------------------
12 */
13
14 !function($){
15
16 	$(document).ready(function(){
17
18		if ($.support.t3transform !== false) {
19
20			var $btn = $('.btn-navbar[data-toggle="collapse"]'),
21				$nav = null,
22				$fixeditems = null;
23
24			if (!$btn.length){
25				return;
26			}
27
28			//mark that we have off-canvas menu
29			$(document.documentElement).addClass('off-canvas-ready');
30
31			$nav = $('<div class="t3-mainnav" />').appendTo($('<div id="off-canvas-nav"></div>').appendTo(document.body));
32
33			//not all btn-navbar is used for off-canvas
34			var $navcollapse = $btn.parent().find($btn.data('target') + ':first');
35			if(!$navcollapse.length){
36				$navcollapse = $($btn.data('target') + ':first');
37			}
38			var $ocnav = $navcollapse.clone().appendTo($nav);
39			// enable menu hover
40			$ocnav.find('li.dropdown > a, li.dropdown-submenu > a').on('click tap', function(e) {
41				var $a = $(this), $p = $a.parent();
42				if (!$p.hasClass('open')) {
43					e.stopPropagation();
44					e.preventDefault();
45					$ocnav.find('li.dropdown, li.dropdown-submenu').each(function(){
46						if ($(this).has($a).length==0) $(this).removeClass('open');
47					});
48					$p.addClass('open');
49				}
50			});
51
52			$btn.click (function(e){
53				if ($(this).data('off-canvas') == 'show') {
54					hideNav();
55				} else {
56					showNav();
57				}
58
59				return false;
60			});
61
62			var posNav = function () {
63				var t = $(window).scrollTop();
64				if (t > 0 && t < $nav.position().top) $nav.css('top', t);
65			},
66
67			bdHideNav = function (e) {
68				e.preventDefault();
69				hideNav();
70				return false;
71			},
72
73			showNav = function () {
74				$('html').addClass ('off-canvas');
75
76				$nav.css('top', $(window).scrollTop());
77				wpfix(1);
78
79				setTimeout (function(){
80					$btn.data('off-canvas', 'show');
81					$('html').addClass ('off-canvas-enabled');
82					$(window).on('scroll touchmove', posNav);
83
84					// hide when click on off-canvas-nav
85					$('#off-canvas-nav').on ('click tap', function (e) {
86						e.stopPropagation();
87					});
88
89					//$('#off-canvas-nav a').on ('click', hideNav);
90					$('body').on ('click', bdHideNav);
91				}, 50);
92
93				setTimeout (function(){
94					wpfix(2);
95				}, 1000);
96			},
97
98			hideNav = function (e) {
99
100				//prevent close on the first click of parent item
101				if(e && e.type == 'click'
102					&& e.target.tagName.toUpperCase() == 'A'
103					&& $(e.target).parent('li').data('noclick')){
104					return true;
105				}
106
107				$(window).off('scroll touchmove', posNav);
108				$('#off-canvas-nav').off ('click');
109				//$('#off-canvas-nav a').off ('click', hideNav);
110				$('body').off ('click tap', bdHideNav);
111
112				$('html').removeClass ('off-canvas-enabled');
113				$btn.data('off-canvas', 'hide');
114
115				setTimeout (function(){
116					$('html').removeClass ('off-canvas');
117				}, 600);
118			},
119
120			wpfix = function (step) {
121				// check if need fixed
122				if ($fixeditems == -1){
123					return;// no need to fix
124				}
125
126				if (!$fixeditems) {
127					$fixeditems = $('body').children().filter(function(){ return $(this).css('position') === 'fixed' });
128					if (!$fixeditems.length) {
129						$fixeditems = -1;
130						return;
131					}
132				}
133
134				if (step==1) {
135					$fixeditems.each (function () {
136						var $this = $(this);
137						var style = $this.attr('style'),
138						opos = style && style.match('position') ? $this.css('position'):'',
139						otop = style && style.match('top') ? $this.css('top'):'';
140
141						$this.data('opos', opos).data('otop', otop);
142						$this.css({'position': 'absolute', 'top': ($(window).scrollTop() + parseInt($this.css('top'))) });
143					});
144
145				} else {
146					$fixeditems.each (function () {
147						$this = $(this);
148						$this.css({'position': $this.data('opos'), 'top': $this.data('otop')});
149					});
150				}
151			};
152		}
153	});
154
155}(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.