PageSourceSearch

https://ncbeonline.com/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/tabs/tabs.js?ver=7.1.2

js ncbeonline.com collected 2026-09-24 12:07:24 UTC 3,255 bytes, 127 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');
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).bind('click', function()
42				{
43					open_content(tab, i, the_oldtab);
44					return false;
45				});
46	
47				if(newtabs)
48				{
49					the_oldtab.bind('click', function()
50					{
51						open_content(the_oldtab, i, tab);
52						return false;
53					});
54				}
55			});
56	
57			set_size();
58			trigger_default_open(false);
59			win.on("debouncedresize", set_size);
60			
61	        $('a').on('click',function(){
62	            var hash = $(this).attr('href');
63	            if(typeof hash != "undefined" && hash)
64	            {
65	                hash = hash.replace(/^.*?#/,'');
66	                trigger_default_open('#'+hash);
67	            }
68	        });
69	
70			function set_size()
71			{
72				if(!options.sidebar) return;
73				content.css({'min-height': tab_titles.outerHeight() + 1});
74			}
75	
76			function open_content(tab, i, alternate_tab)
77			{
78				if(!tab.is('.'+options.active))
79				{
80					$('.'+options.active, container).removeClass(options.active);
81					$('.'+options.active+'_content', container).removeClass(options.active+'_content');
82	
83					tab.addClass(options.active);
84	
85					var new_loc = tab.data('fake-id');
86					if(typeof new_loc == 'string') location.replace(new_loc);
87	
88					if(alternate_tab) alternate_tab.addClass(options.active);
89					var active_c = content.filter(':eq('+i+')').addClass(options.active+'_content');
90	
91					if(typeof click_container != 'undefined' && click_container.length)
92					{
93						sidebar_shadow.height(active_c.outerHeight());
94					}
95					
96					//check if tab title is in viewport. if not scroll up
97					var el_offset = active_c.offset().top,
98						scoll_target = el_offset - 50 - parseInt($('html').css('margin-top'),10);
99					
100					if(win.scrollTop() > el_offset)
101					{
102						$('html:not(:animated),body:not(:animated)').scrollTop(scoll_target);
103					}
104				}
105				
106				win.trigger( 'av-content-el-height-changed', tab );
107			}
108	
109			function trigger_default_open(hash)
110			{
111				if(!hash && window.location.hash) hash = window.location.hash;
112	            		if(!hash) return;
113	            		
114				var open = tabs.filter('[data-fake-id="'+hash+'"]');
115	
116				if(open.length)
117				{
118					if(!open.is('.active_tab')) open.trigger('click');
119					window.scrollTo(0, container.offset().top - 70);
120				}
121			}
122	
123		});
124	};
125
126	
127}(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.