PageSourceSearch

https://www.tanoahotels.com/wp-content/themes/tanoa-hotel-theme/includes/js/global.js?ver=1790424809

js tanoahotels.com collected 2026-09-26 12:14:03 UTC 7,446 bytes, 320 lines download raw bytes

1jQuery(function($) {
2	
3	if( $('img.retina').length > 0 ) {
4					
5		$('img.retina').each(function() {
6					
7			if( $(this).parent().width() > ( $(this).attr('width') / 2 ) ) {
8				
9				$(this).css( 'max-width', ( $(this).attr('width') / 2 ) + 'px' );
10				
11			}
12			
13		});
14		
15	}
16		
17	if( $('.hero-slider').length > 0 ) {
18		
19		if( $('.hero-slider .hero-slide').length > 1 ) {
20		
21			$('.hero-slider').on('init', function(slick) {
22				
23				$('.hero-slide').removeClass('d-none');
24				
25			});
26		
27			$('.hero-slider').slick({
28				autoplay: true,
29				dots:false,
30				slidesToShow: 1,
31				autoplaySpeed:5000,
32				slide: '.hero-slide',
33			});
34		
35		}
36		
37	}
38	
39	if( $('.promo-slider').length > 0 ) {
40		
41		$('.promo-slider').on('init', function() {
42		
43			if( $(window).width() < 992 ) {
44				
45				$('#promo-slider-nav').css({
46					'width': $('.promo-slider .promo-slide:first-child .content-section').outerWidth() + 'px',
47					'top': ( ( $('.promo-slider .promo-slide:first-child .content-section').offset().top - $('.promo-slider').offset().top ) + 10 ) + 'px',
48				});
49				
50				if( $(window).width() < 768 ) {
51				
52					$('#promo-slider-nav').css({
53						'left': ( ( $('.promo-slider').width() - $('.promo-slider .promo-slide:first-child .content-section').outerWidth() ) / 2 ) + 'px',
54					});
55					
56				}
57				
58			}
59			
60		});
61		
62		$('.promo-slider').slick({
63			autoplay: false,
64			dots:false,
65			slidesToShow: 1,
66			arrows: true,
67			slide: '.promo-slide',
68			responsive: [
69				{
70					breakpoint: 991,
71					settings: {
72						appendArrows: $('#promo-slider-nav'),
73					}
74				}
75			],
76			
77		});
78		
79	}
80	
81	$(window).resize(function() {
82		
83		setTimeout(function() {
84		
85			if( $('img.retina').length > 0 ) {
86					
87				$('img.retina').each(function() {
88							
89					if( $(this).parent().width() > ( $(this).attr('width') / 2 ) ) {
90						
91						$(this).css( 'max-width', ( $(this).attr('width') / 2 ) + 'px' );
92						
93					}
94					else {
95						
96						$(this).removeAttr('style');
97						
98					}
99					
100				});
101				
102			}
103			
104		}, 100 );
105		
106		if( $('.promo-slider').length > 0 ) {
107			
108			setTimeout(function() {
109		
110				if( $(window).width() < 992 ) {
111					
112					$('#promo-slider-nav').removeAttr('style');
113					
114					$('#promo-slider-nav').css({
115						'width': $('.promo-slider .promo-slide:first-child .content-section').outerWidth() + 'px',
116						'top': ( ( $('.promo-slider .promo-slide:first-child .content-section').offset().top - $('.promo-slider').offset().top ) + 10 ) + 'px',
117					});
118					
119					if( $(window).width() < 768 ) {
120						
121						$('#promo-slider-nav').removeAttr('style');
122						
123						$('#promo-slider-nav').css({
124							'width': $('.promo-slider .promo-slide:first-child .content-section').outerWidth() + 'px',
125							'top': ( ( $('.promo-slider .promo-slide:first-child .content-section').offset().top - $('.promo-slider').offset().top ) + 10 ) + 'px',
126							'left': ( ( $('.promo-slider').width() - $('.promo-slider .promo-slide:first-child .content-section').outerWidth() ) / 2 ) + 'px',
127						});
128					}
129					
130					/* restore booking form */
131					if( $('header.fixed .booking-form-section').length > 0 ) {
132						
133						$('header.fixed .booking-form-section').appendTo( $('.hero-section') );
134						
135					}
136					
137				}
138				else {
139					
140					$('#promo-slider-nav').removeAttr('style');	
141					
142				}
143				
144			}, 100 );
145			
146		}
147		
148		setTimeout(function() {
149		
150			/* Booking form related */
151			if( $(window).width() < 992 ) {
152				
153				/* restore booking form */
154				if( $('header.fixed .booking-form-section').length > 0 ) {
155					
156					if( $('.after-hero-section').length > 0 ) {
157						
158						$('header.fixed .booking-form-section').appendTo( $('.after-hero-section') );
159						
160					}
161					else {
162					
163						$('header.fixed .booking-form-section').appendTo( $('.hero-section') );
164						
165					}
166					
167				}
168				
169			}
170			else {
171				
172				/* Remove booking form fixed classes */
173				$('.hero-section .booking-form-section').removeClass('fixed');
174				
175				$('.hero-section .booking-form-section').removeAttr('style');
176				
177				$('header').removeClass('booking-form-fixed');
178						
179			}
180			
181		}, 100 );
182		
183	});
184	
185	var booking_form_section_offset = 0;
186	
187	var lastscroll = 0;
188	
189	var scrolled = false;
190	
191	$(window).on('scroll', function() {
192		
193		if( $(window).scrollTop() > 0 ) {
194			
195			$('header').addClass('fixed');
196			
197			if( !scrolled ) {
198				
199				$('#main').css('margin-top', $('header').height() + 'px');
200				
201				scrolled = true;
202				
203			}
204			
205		}
206		else {
207			
208			$('header').removeClass('fixed');
209			
210			$('#main').removeAttr('style');
211			
212			scrolled = false;
213			
214		}
215		
216		/* Scroll down */
217		if( lastscroll < $(window).scrollTop() ) {
218		
219			if( $(window).width() >= 992 ) {
220		
221				if( $('.hero-section .booking-form-section').length > 0 ) {
222					
223					booking_form_section_offset = $('.hero-section .booking-form-section').offset().top;
224					
225					if( $('.after-hero-section .booking-form-section').length > 0 ) {
226						
227						booking_form_section_offset = $('.after-hero-section .booking-form-section').offset().top;
228						
229					}
230						
231					if( ( $(window).scrollTop() + $('header').height() ) >= booking_form_section_offset ) {
232						
233						if( $('.after-hero-section .booking-form-section').length > 0 ) {
234							
235							$('.after-hero-section .booking-form-section').appendTo('header');
236							
237						}
238						else {
239							
240							$('.hero-section .booking-form-section').appendTo('header');
241							
242						}
243						
244						$('header').addClass('booking-form-appended');
245						
246					}
247				
248				}
249				
250			}
251			else {
252				
253				booking_form_section_offset = $('.hero-section .booking-form-section').offset().top;
254				
255				if( ( $(window).scrollTop() + $('header').height() ) >= booking_form_section_offset ) {
256					
257					$('.hero-section .booking-form-section').addClass('fixed');
258					
259					$('.hero-section .booking-form-section').css({
260						'top' : $('header').height() + 'px',
261					});
262					
263					$('header').addClass('booking-form-fixed');
264					
265				}
266				
267			}
268			
269		}
270		
271		/* Scroll up */
272		if( lastscroll > $(window).scrollTop() ) {
273			
274			if( $(window).width() >= 992 ) {
275		
276				if( $('header .booking-form-section').length > 0 ) {
277					
278					if( ( $(window).scrollTop() + $('header').height() ) < ( $('.hero-section').offset().top + $('.hero-section').height() ) ) {
279						
280						if( $('.after-hero-section').length > 0 ) {
281							
282							$('header .booking-form-section').appendTo('.after-hero-section');
283							
284						}
285						else {
286						
287							$('header .booking-form-section').appendTo('.hero-section');
288							
289						}
290						
291						$('header').removeClass('booking-form-appended');
292						
293					}
294					
295				}
296				
297			}
298			else {
299				
300				booking_form_section_offset = $('.hero-section').offset().top + $('.hero-section').height();
301				
302				if( ( $(window).scrollTop() + $('header').height() ) < booking_form_section_offset ) {
303					
304					$('.hero-section .booking-form-section').removeClass('fixed');
305					
306					$('.hero-section .booking-form-section').removeAttr('style');
307					
308					$('header').removeClass('booking-form-fixed');
309					
310				}
311				
312			}
313			
314		}
315		
316		lastscroll = $(window).scrollTop();
317		
318	});
319	
320});

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.