PageSourceSearch

https://www.runningcheese.cn/js/jquery-tab.js

js runningcheese.cn collected 2026-10-09 22:08:52 UTC 1,777 bytes, 64 lines download raw bytes

1;(function(defaults, $, window, document, undefined) {
2
3	'use strict';
4
5	$.extend({
6		// Function to change the default properties of the plugin
7		// Usage:
8		// jQuery.tabifySetup({property:'Custom value'});
9		tabifySetup : function(options) {
10
11			return $.extend(defaults, options);
12		}
13	}).fn.extend({
14		// Usage:
15		// jQuery(selector).tabify({property:'value'});
16		tabify : function(options) {
17
18			options = $.extend({}, defaults, options);
19
20			return $(this).each(function() {
21        var $element, tabHTML, $tabs, $sections;
22        
23        $element = $(this);
24        $sections = $element.children();
25        
26        // Build tabHTML
27        tabHTML = '<ul class="tab-nav">';
28        $sections.each(function() {
29          if ($(this).attr("title") && $(this).attr("id")) {
30            tabHTML += '<li><a href="#' + $(this).attr("id") + '">' + $(this).attr("title") + '</a></li>';
31          }
32        });
33        tabHTML += '</ul>';
34        
35        // Prepend navigation
36        $element.prepend(tabHTML);
37        
38        // Load tabs
39        $tabs = $element.find('.tab-nav li');
40        
41        // Functions
42        var activateTab = function(id) {
43          $tabs.filter('.active').removeClass('active');
44          $sections.filter('.active').removeClass('active');
45          $tabs.has('a[href="' + id + '"]').addClass('active');
46          $sections.filter(id).addClass('active');
47        }
48        
49        // Setup events
50        $tabs.on('click', function(e){
51          activateTab($(this).find('a').attr('href'));
52          e.preventDefault();
53        });
54        
55        // Activate first tab
56        activateTab($tabs.first().find('a').attr('href'));
57        
58			});
59		}
60	});
61})({
62	property : "value",
63	otherProperty : "value"
64}, jQuery, window, document);

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.