PageSourceSearch

https://fx678.com/js/jquery.tabs.js

js fx678.com collected 2026-10-02 03:10:54 UTC 2,047 bytes, 85 lines download raw bytes

1/* =================================================
2// jQuery Tabs Plugins 1.0
3// author:[email protected]
4// URL:http://stylechen.com/jquery-tabs.html
5// 4th Dec 2010
6// =================================================*/
7
8;(function($){
9	$.fn.extend({
10		Tabs:function(options){
11			// 处理参数
12			options = $.extend({
13				event : 'mouseover',
14				timeout : 0,
15				auto : 0,
16				callback : null
17			}, options);
18			
19			var self = $(this),
20				tabBox = self.children( 'div.tab_box' ).children( 'div' ),
21				menu = self.children( 'ul.tab_menu' ),
22				items = menu.find( 'li' ),
23				timer;
24				
25			var tabHandle = function( elem ){
26					elem.siblings( 'li' )
27						.removeClass( 'current' )
28						.end()
29						.addClass( 'current' );
30						
31					tabBox.siblings( 'div' )
32						.addClass( 'hide' )
33						.end()
34						.eq( elem.index() )
35						.removeClass( 'hide' );
36				},
37					
38				delay = function( elem, time ){
39					time ? setTimeout(function(){ tabHandle( elem ); }, time) : tabHandle( elem );
40				},
41				
42				start = function(){
43					if( !options.auto ) return;
44					timer = setInterval( autoRun, options.auto );
45				},
46				
47				autoRun = function(){
48					var current = menu.find( 'li.current' ),
49						firstItem = items.eq(0),
50						len = items.length,
51						index = current.index() + 1,
52						item = index === len ? firstItem : current.next( 'li' ),
53						i = index === len ? 0 : index;
54					
55					current.removeClass( 'current' );
56					item.addClass( 'current' );
57					
58					tabBox.siblings( 'div' )
59						.addClass( 'hide' )
60						.end()
61						.eq(i)
62						.removeClass( 'hide' );
63				};
64							
65			items.bind( options.event, function(){
66				delay( $(this), options.timeout );
67				if( options.callback ){
68					options.callback( self );
69				}
70			});
71			
72			if( options.auto ){
73				start();
74				self.hover(function(){
75					clearInterval( timer );
76					timer = undefined;
77				},function(){
78					start();
79				});
80			}
81			
82			return this;
83		}
84	});
85})(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.