PageSourceSearch

https://www.jardin5sens.net/en/wp-content/themes/enfold/config-tem…/avia-shortcodes/tabs/tabs.js?ver=7.1.2

js jardin5sens.net collected 2026-10-02 10:58:34 UTC 3,676 bytes, 141 lines download raw bytes

1// -------------------------------------------------------------------------------------------
2// Tab Shortcode
3// -------------------------------------------------------------------------------------------
4
5(function($)
6{ 
7	"use strict";
8
9	$.fn.avia_sc_tabs= function(options)
10	{
11		var defaults =
12		{
13			heading: '.tab',
14			content:'.tab_content',
15			active:'active_tab',
16			sidebar: false
17		};
18	
19		var win = $(window),
20			options = $.extend(defaults, options);
21	
22		return this.each(function()
23		{
24			var container 	= $(this),
25				tab_titles 	= $('<div class="tab_titles"></div>').prependTo(container),
26				tabs 		= $(options.heading, container),
27				content 	= $(options.content, container),
28				newtabs 	= false,
29				oldtabs 	= false;
30	
31			newtabs = tabs.clone();
32			oldtabs = tabs.addClass('fullsize-tab').attr('aria-hidden', true );
33			tabs = newtabs;
34	
35			tabs.prependTo(tab_titles).each(function(i)
36			{
37				var tab = $(this), the_oldtab = false;
38	
39				if(newtabs) the_oldtab = oldtabs.filter(':eq('+i+')');
40	
41				tab.addClass('tab_counter_'+i).on('click', function()
42				{
43					open_content(tab, i, the_oldtab);
44					return false;
45				});
46				
47				tab.on('keydown', function(objEvent)
48				{
49					if (objEvent.keyCode === 13) { // if user presses 'enter'
50								tab.trigger('click');
51							}
52				});
53	
54				if(newtabs)
55				{
56					the_oldtab.on('click', function()
57					{
58						open_content(the_oldtab, i, tab);
59						return false;
60					});
61					
62					the_oldtab.on('keydown', function(objEvent)
63					{
64						if (objEvent.keyCode === 13) { // if user presses 'enter'
65									the_oldtab.trigger('click');
66								}
67					});
68				}
69			});
70	
71			set_size();
72			trigger_default_open(false);
73			win.on("debouncedresize", set_size);
74			
75	        $('a').on('click',function(){
76	            var hash = $(this).attr('href');
77	            if(typeof hash != "undefined" && hash)
78	            {
79	                hash = hash.replace(/^.*?#/,'');
80	                trigger_default_open('#'+hash);
81	            }
82	        });
83	
84			function set_size()
85			{
86				if(!options.sidebar) return;
87				content.css({'min-height': tab_titles.outerHeight() + 1});
88			}
89	
90			function open_content(tab, i, alternate_tab)
91			{
92				if(!tab.is('.'+options.active))
93				{
94					$('.'+options.active, container).removeClass(options.active);
95					$('.'+options.active+'_content', container).attr('aria-hidden', true).removeClass(options.active+'_content');
96	
97					tab.addClass(options.active);
98	
99					var new_loc = tab.data('fake-id');
100					if(typeof new_loc == 'string') location.replace(new_loc);
101	
102					if(alternate_tab) alternate_tab.addClass(options.active);
103					var active_c = content.filter(':eq('+i+')').addClass(options.active+'_content').attr('aria-hidden', false);
104	
105					if(typeof click_container != 'undefined' && click_container.length)
106					{
107						sidebar_shadow.height(active_c.outerHeight());
108					}
109					
110					//check if tab title is in viewport. if not scroll up
111					var el_offset = active_c.offset().top,
112						scoll_target = el_offset - 50 - parseInt($('html').css('margin-top'),10);
113					
114					if(win.scrollTop() > el_offset)
115					{
116						$('html:not(:animated),body:not(:animated)').scrollTop(scoll_target);
117					}
118				}
119				
120				win.trigger( 'av-content-el-height-changed', tab );
121			}
122	
123			function trigger_default_open(hash)
124			{
125				if(!hash && window.location.hash) hash = window.location.hash;
126	            		if(!hash) return;
127	            		
128				var open = tabs.filter('[data-fake-id="'+hash+'"]');
129	
130				if(open.length)
131				{
132					if(!open.is('.active_tab')) open.trigger('click');
133					window.scrollTo(0, container.offset().top - 70);
134				}
135			}
136	
137		});
138	};
139
140	
141}(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.