PageSourceSearch

https://www.dunstan.co.nz/edit/modules/rotator/rotator.js?version=1.0.10

js dunstan.co.nz collected 2026-10-08 07:13:09 UTC 3,512 bytes, 124 lines download raw bytes

1// Rototar JavaScript Document
2
3	$(document).ready(function() {
4
5		// Unslider set up
6		if($.fn.unslider && $(".unslider-holder").length > 0) {
7			
8			// For each unslider, initiate
9			$(".unslider-holder").each(function() {
10				
11				// Get options
12				var animation = $(this).data("animation");
13				var speed  = $(this).data("speed");
14				var delay  = $(this).data("delay");
15				var arrows = $(this).data("arrows");
16				var prev   = $("#image-rotator-prev").html();
17				var next   = $("#image-rotator-next").html();
18				var nav   = $(this).data("nav");
19				
20				arrows = (arrows) ? {
21						prev: '<a class="unslider-arrow prev">'+prev+'</a>',
22						next: '<a class="unslider-arrow next">'+next+'</a>',
23					} : false;
24				
25				// Get slider element
26				var slider = $(this);
27				
28				// Set on ready event
29				$(slider).on("unslider.ready",function() {
30					
31					// Set this
32					var t = $(this);
33					
34					// Reset animation			
35					$(t).find(".sliderimg:nth-child("+((animation === 'fade') ? 1 : 2)+")").addClass("reset-animation");
36					
37					// Add show slider class
38					setTimeout(function() {
39						//
40						$(t).addClass("show-unslider");
41						$(t).find(".sliderimg:nth-child("+((animation === 'fade') ? 1 : 2)+")").addClass("unslider-animate").removeClass("reset-animation");
42					},10);
43				});
44				
45				var index = (animation === 'fade') ? 'first' : 'first';
46				
47				
48				//
49				$(slider).unslider({
50					animation: animation, // fade, horizontal, vertical
51					autoplay: true,
52					infinite: true,
53					index: index,
54					speed: speed,
55					delay: delay,
56					//fluid: true,
57					arrows: arrows,
58					nav: nav
59				});
60				
61				// Set on change event
62				$(slider).on("unslider.change",function(event,index,slide,slide2) {
63					
64					// Background image
65					if($(".sliderimg.backgroundimage-container").length > 0 && $.fn.backgroundimage) {
66						
67						// Backgrounds
68						$(".sliderimg.backgroundimage-container").backgroundimage('update');	
69					}
70									
71					// Remove animate for old slide and add to new
72					$(this).find(".sliderimg").removeClass("unslider-animate");
73					$(slide).addClass("unslider-animate");
74					$(slide2).addClass("unslider-animate");
75				});
76				
77				// Enable swiping
78				if($.fn.swipe) {
79					$(slider).find(".sliderimg").swipe({
80						swipeLeft: function(event, direction, distance, duration, fingerCount, fingerData) {
81							if(direction === "left") {
82								$(slider).data("unslider").next();
83							}
84						},
85						threshold:75,
86						swipeRight:function(event, direction, distance, duration, fingerCount, fingerData) {
87							if(direction === "right") {
88								$(slider).data("unslider").prev();
89							}
90						},
91						threshold:75 
92					});
93				}
94				
95				// Set up background image on each slide
96				$(slider).find(".sliderimg").backgroundimage();
97				
98				// Bind update function
99				$(slider).bind('updateSlider',function() {
100					//
101					var containerHeight = $(this).data("height");
102		
103					$(this).height(containerHeight);
104					$(this).find(".sliderimg").height(containerHeight);
105					$(this).find(".sliderimg .wrap").height(containerHeight);
106				});
107				
108				// Run functions during resize
109				$(window).resize(function() {
110		
111					// Update slider
112					$(slider).trigger('updateSlider');
113				});
114								
115				// Update slider
116				$(slider).trigger('updateSlider');
117			});
118			
119			//
120			$(window).resize();
121		}
122	});
123	
124	

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.