PageSourceSearch

https://www.youronlinechoices.com/javascript/hashslider.js

js youronlinechoices.com collected 2026-09-24 06:54:37 UTC 4,374 bytes, 129 lines download raw bytes

1// hashslider v0.9 by manuel huegel, copyright 2010
2// mgoys.com
3
4
5function makeSlider( obj ){
6	
7	//get width and height of the wrapper and give it to the UL	
8	var wrapperwidth = $('#' + obj.container + '').outerWidth() *  $('#' + obj.container + ' ul > li').size();
9	$('#' + obj.container + ' ul').css('width', wrapperwidth );
10	var wrapperheight = $('#' + obj.container + '').height();
11	$('#' + obj.container + ' ul').css('height', wrapperheight);	
12						   
13	//set my li width
14	var height = $('#' + obj.container + '').height();
15	$('#' + obj.container + ' ul li').css('height', height);
16
17	//set my counter vars
18	var counter = $('#' + obj.container + ' ul > li').size();
19	var decount = 1;
20	var autocount = 1;
21	var autoPlayTime = obj.autoPlayTime;
22	
23	if( ! autoPlayTime ){
24		autoPlayTime = 5000;
25	}
26	
27	var x = setInterval( goNext, autoPlayTime );
28		
29	//slide the button to the next item
30	function goNext() {
31	
32		clearInterval(x);
33		x = setInterval( goNext, autoPlayTime );
34	
35		if ( decount < counter) {
36			
37			$('#' + obj.container + ' .slides').animate({ left: '-=' + $('#' + obj.container + '').width() }, 400, 'swing', function() { });
38			$('.' + obj.sliderlinks + ' a.current').removeClass('current').next().addClass('current');
39			decount++;
40		}else{
41			
42			decount = 1;
43			var clickednum = decount * - $('#' + obj.container + '').width() + $('#' + obj.container + '').width();
44			$('#' + obj.container + ' .slides').animate({ left: clickednum }, 400, 'swing', function() { });
45			$('#' + obj.container + ' .current').removeClass('current');
46
47			$('.' + obj.sliderlinks + ' a').each(function(){
48				$(this).removeClass( 'current' );
49				if( $(this).attr( "pg" ) == decount){
50					$(this).addClass( 'current' );
51				}
52			});
53		}
54	}
55	
56	function goBack() {
57		
58		clearInterval(x);
59		x = setInterval( goNext, autoPlayTime );		
60		
61		if ( decount > 1) {
62			
63			$('#' + obj.container + ' .slides').animate({ left: '+=' + $('#' + obj.container + '').width() }, 400, 'swing', function() { });
64			$('.' + obj.sliderlinks + ' a.current').removeClass('current').prev().addClass('current');
65			decount--;
66			
67		}
68	}
69	
70	//make the number clickable
71	$('.' + obj.sliderlinks + ' a').click(function() { 
72	
73		clearInterval(x);
74		x = setInterval( goNext, autoPlayTime );	
75
76		var clickednum = $(this).attr( "pg" ) * - $('#' + obj.container + '').width() + $('#' + obj.container + '').width();
77		
78		$('#' + obj.container + ' ul').animate({ left: clickednum }, 400, 'swing', function() { });
79		$('.' + obj.sliderlinks + ' .current').removeClass( 'current' );
80		
81		decount = $(this).attr( "pg" );
82		
83		$('.' + obj.sliderlinks + ' a').each(function(){
84			$(this).removeClass( 'current' );
85			if( $(this).attr( "pg" ) == decount){
86				$(this).addClass( 'current' );
87			}
88		});		
89		
90		
91
92		return false;
93	});
94	
95	
96	/*
97	//thaths the hash-shizzle
98	if ( window.location.hash != '') {
99	//get hash, scroll to position
100		var hashnum = window.location.hash.substr(1) * - $('#' + obj.container + '').width() + $('#' + obj.container + '').width();
101		$('#' + obj.container + ' ul').animate({ left: hashnum }, 0, function() { });
102	//set counters to position
103		decount = window.location.hash.substr(1);
104		$('.activenum').removeClass('activenum');
105		var hashname = window.location.hash.substr(1);
106		$('#id' + hashname).addClass('activenum');
107	}
108	*/
109	
110	
111	//get my clickers
112	if( obj.scrollButtonsContainer ){
113		$('#' + obj.scrollButtonsContainer + ' .right').click(function() { goNext(); return false; });	
114		$('#' + obj.scrollButtonsContainer + ' .left').click(function() { goBack(); return false; });	
115	}else{
116		$('#' + obj.container + ' .right').click(function() { goNext(); return false; });	
117		$('#' + obj.container + ' .left').click(function() { goBack(); return false; });	
118	}
119	//get mousewheel function
120	//$("#' + obj.container + ' ul").mousewheel(function(event, delta) { if (delta > 0) { goBack();	event.stopPropagation();event.preventDefault(); } });
121	//$("#' + obj.container + ' ul").mousewheel(function(event, delta) { if (delta < 0) { goNext();  event.stopPropagation();event.preventDefault();	} });
122
123}
124
125/*
126$( '#slider' ).ready(function(){
127	makeSlider( {container:'slider', sliderlinks:'sliderPages', scrollButtonsContainer:'sliderNav', autoPlayTime:5000000000} );
128});
129*/

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.