PageSourceSearch

https://www.gavirental.com/assets/gavir/js/slide_index.js

js gavirental.com collected 2026-10-04 20:19:31 UTC 5,607 bytes, 243 lines download raw bytes

1/*
2* Author:      Marco Kuiper (http://www.marcofolio.net/)
3*/
4
5// Speed of the automatic slideshow
6var slideshowSpeed = 4000;
7
8
9
10
11
12$(document).ready(function() {
13		
14	switch ($('html').attr('lang')) {
15		case 'es':
16			// Variable to store the images we need to set as background
17			// which also includes some text and url's.
18			var photos = [ {
19					"title" : "",
20					"image" : "images/slide-home/slide1.jpg",
21					"firstline" : "",
22					"secondline" : ""
23				}, {
24					"title" : "",
25					"image" : "images/slide-home/slide2.jpg",
26					"firstline" : "",
27					"secondline" : ""
28				}, {
29					"title" : "",
30					"image" : "images/slide-home/slide3.jpg",
31					"firstline" : "",
32					"secondline" : ""
33				}, {
34					"title" : "",
35					"image" : "images/slide-home/slide4.jpg",
36					"firstline" : "",
37					"secondline" : ""
38				}
39			];
40			break;
41		case 'en':
42		case 'fr':
43			// Variable to store the images we need to set as background
44			// which also includes some text and url's.
45			var photos = [ {
46					"title" : "",
47					"image" : "images/slide-home/slide1-sin-texto.jpg",
48					"firstline" : "",
49					"secondline" : ""
50				}, {
51					"title" : "",
52					"image" : "images/slide-home/slide2.jpg",
53					"firstline" : "",
54					"secondline" : ""
55				}, {
56					"title" : "",
57					"image" : "images/slide-home/slide3.jpg",
58					"firstline" : "",
59					"secondline" : ""
60				}, {
61					"title" : "",
62					"image" : "images/slide-home/slide4.jpg",
63					"firstline" : "",
64					"secondline" : ""
65				}
66			];
67			break;
68	}
69
70	// Backwards navigation
71	$("#back").click(function() {
72		stopAnimation();
73		navigate("back");
74	});
75	
76	// Forward navigation
77	$("#next").click(function() {
78		stopAnimation();
79		navigate("next");
80	});
81	
82	var interval;
83
84
85	$('#control').click(function() {
86    if($(this).hasClass("clicked")) {
87        // Change the background image to "pause"
88		$(this).css( "background-position", "-1px 0" );
89		$( "#control" ).hover(
90		  function() {
91		    	$( this ).css( "background-position", "-23px 0" );
92		  }, function() {
93			     $( this ).css( "background-position", "-1px 0" );
94		  }
95		);
96
97		
98		// Show the next image
99		navigate("next");
100		
101		// Start playing the animation
102		interval = setInterval(function() {
103			navigate("next");
104		}, slideshowSpeed);
105		$(this).removeClass("clicked");
106       
107    } else {
108    	stopAnimation();
109        $(this).addClass("clicked");
110        
111    }
112	}); 
113
114	//$( "#control" ).hover(
115	//  function() {
116	//    if($(this).hasClass("clicked")) { 
117	//    	$( this ).css( "background-position", "-66px 0" );
118	//    }
119	//    else { 
120	//    		$( this ).css( "background-position", "-22px 0" );
121	//    	}
122	//  }, function() {
123	//	    if($(this).hasClass("clicked")) { 
124	//	    	$( this ).css( "background-position", "-44px 0" );
125	//	    }
126	//	    else { 
127	//	    		$( this ).css( "background-position", "0 0" );
128	//	    	}
129	//  }
130	//);
131
132
133	//$("#control").toggle(function(){
134	//	stopAnimation();
135	//}, function() {
136	//	// Change the background image to "pause"
137	//	$(this).css({ "background-image" : "url(assets/gavir/css/images/btn_pause.png)" });
138	//	
139	//	// Show the next image
140	//	navigate("next");
141	//	
142	//	// Start playing the animation
143	//	interval = setInterval(function() {
144	//		navigate("next");
145	//	}, slideshowSpeed);
146	//});
147	
148	
149	var activeContainer = 1;	
150	var currentImg = 0;
151	var animating = false;
152	var navigate = function(direction) {
153		// Check if no animation is running. If it is, prevent the action
154		if(animating) {
155			return;
156		}
157		
158		// Check which current image we need to show
159		if(direction == "next") {
160			currentImg++;
161			if(currentImg == photos.length + 1) {
162				currentImg = 1;
163			}
164		} else {
165			currentImg--;
166			if(currentImg == 0) {
167				currentImg = photos.length;
168			}
169		}
170		
171		// Check which container we need to use
172		var currentContainer = activeContainer;
173		if(activeContainer == 1) {
174			activeContainer = 2;
175		} else {
176			activeContainer = 1;
177		}
178		
179		showImage(photos[currentImg - 1], currentContainer, activeContainer);
180		
181	};
182	
183	var currentZindex = -1;
184	var showImage = function(photoObject, currentContainer, activeContainer) {
185		animating = true;
186		
187		// Make sure the new container is always on the background
188		currentZindex--;
189		
190		// Set the background image of the new active container
191		$("#headerimg" + activeContainer).css({
192			"background-image" : "url(/assets/gavir/" + photoObject.image + ")",
193			"display" : "block",
194			"z-index" : currentZindex
195		});
196		
197		// Hide the header text
198		$("#headertxt").css({"display" : "none"});
199		
200		// Set the new header text
201		$("#firstline").html(photoObject.firstline);
202		$("#secondline")
203			//.attr("href", photoObject.url)
204			.html(photoObject.secondline);
205		$("#pictureduri")
206			//.attr("href", photoObject.url)
207			.html(photoObject.title);
208		
209		
210		// Fade out the current container
211		// and display the header text when animation is complete
212		$("#headerimg" + currentContainer).fadeOut(function() {
213			setTimeout(function() {
214				$("#headertxt").css({"display" : "block"});
215				animating = false;
216			}, 900);
217		});
218	};
219	
220	var stopAnimation = function() {
221		// Change the background image to "play"
222		$("#control").css( "background-position", "-45px 0" );
223		$( "#control" ).hover(
224		  function() {
225		    	$( this ).css( "background-position", "-67px 0" );
226		  }, function() {
227			     $( this ).css( "background-position", "-45px 0" );
228		  }
229		);
230		
231		// Clear the interval
232		clearInterval(interval);
233	};
234	
235	// We should statically set the first image
236	navigate("next");
237	
238	// Start playing the animation
239	interval = setInterval(function() {
240		navigate("next");
241	}, slideshowSpeed);
242	
243});

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.