PageSourceSearch

https://www.thaicountryclub.com/themes/kos/js/homepage.js

js thaicountryclub.com collected 2026-10-04 08:00:32 UTC 7,561 bytes, 248 lines download raw bytes

1$(document).ready(function(){
2	var edit = $('body.edit').length;
3	slideHeight()
4	setTimeout(function(){
5		BlockBg()
6		scroll_shirnk();
7	},500);
8	SliderBg()
9	pageMargin();
10	getBackground();
11
12	$('.block-slider').find('.each-banner').each(function(){
13		$('.slide-block').appendTo('.link-slide>div>div');
14	})
15	$('.block-slider .each-banner:first-of-type').addClass('active');
16	$('.link-slide .slide-block:first-of-type').addClass('initial');
17	
18
19	var count=$('.each-banner').length;
20	//console.log('count : '+count);
21	$('.slide-num .all').text(count);
22	$('.link-slide').find('.slide-block').each(function(i) {
23	    $(this).attr('data-id',(++i))  ;
24	});
25	
26	var nav = $('.link-slide').find('.slide-block a');
27	var box = $('.block-slider .each-banner');
28	nav.parent().first().addClass('active');
29	box.first().show();
30	nav.click(function(){
31		var hh =$('header').outerHeight();
32		var parent = $(this).parent();
33		var index = parent.index();
34		if(!parent.hasClass('active')){
35			box.slideUp();
36			box.eq(index).slideDown();
37			nav.parent().removeClass('active');
38			nav.parent().removeClass('shrink');
39			nav.parent().removeClass('initial');
40			parent.addClass('active');			
41		}
42		if($(window).width()>1100){
43			$('html,body').animate({ scrollTop: $('.link-slide').offset().top}, 800);
44		}else{
45			$('html,body').animate({ scrollTop: ($('.link-slide').offset().top)-hh}, 800);
46		}
47		
48		return false;
49		// $('.block-slider .each-banner').removeClass('active');
50		// $('.link-slide .slide-block').removeClass('active');
51		// $('.link-slide .slide-block').removeClass('shrink');
52		// $('.link-slide .slide-block').removeClass('initial');
53		// var title=$(this).parent().attr('data-title');
54		// var id=$(this).parent().attr('data-id');
55		// console.log('title : '+title);
56		// console.log('id : '+id);
57
58		// $('.block-slider .each-banner[data-title='+title+']').slideDown();
59		// $('.block-slider .each-banner[data-title='+title+']').addClass('active');
60		
61		// $('.link-slide .slide-block[data-title='+title+']').addClass('active');
62		// $('.slide-num .this-page').text(id);
63	})
64	
65	// $('.slide-block a[href^="#"]').click(function() {
66		// if($(window).width() > 800){
67			// $('html,body').animate({ scrollTop: $(this.hash).offset().top -0}, 700);
68		// }else {
69			// $('html,body').animate({ scrollTop: $(this.hash).offset().top -0}, 700);
70			
71
72		// }
73		// return false;
74		// e.preventDefault();
75	// });
76
77
78	$('.no-edit .home-slider .slider').bxSlider({
79		auto:true,
80		speed:1000,
81		pause:6000,
82		mode:'fade',
83		adaptiveHeight:true
84	});
85
86	if(!edit){
87		var item = $('.home-banner .block-slider .each-slide');
88		item.each(function(){
89			var src = $(this).find('img').attr('src');
90			$(this).css('background-image','url('+src+')');
91		})
92		item.addClass('navInNext');
93		item.find('.ban-content').addClass('animated');
94
95	}
96	
97	//ChangePos()
98	addDataSr()
99
100$(window).load(function(){
101	slideHeight()
102	pageMargin()	
103	
104}).resize(function() {
105	BlockBg()
106	pageMargin()
107	SliderBg()
108	//ChangePos()
109	slideHeight()
110	scroll_shirnk();
111});
112
113
114function BlockBg(){
115	$('.block-parallax .block-form').css('padding-bottom','');
116	var hg = $(window).height();
117	var head =$('.top-header').outerHeight(true);
118	var link =$('.link-slide>div').outerHeight(true);
119	$('.page-content').find('.home-slider  .block-form').each(function(){
120		//var hg = $(this).parent().find('.text').height();
121		var src = $(this).find('img').attr('src');
122		$(this).css('background-image','url('+src+')');			
123		$(this).css('background-position','center');			
124		$(this).css('background-size','cover');			
125		$(this).find('img').css('display','none');			
126		//$(this).height(hg);				
127
128		var content= $(this).find('.ban-content').outerHeight(true);
129		var all = hg-(head+link+content)/2;
130		// console.log('hg : '+hg);
131		// console.log('head : '+head);
132		// console.log('link : '+link);
133		// console.log('content : '+content);
134		// console.log('all : '+all);
135		$(this).css('padding-bottom',all/2);
136		$(this).css('padding-top',all/2);
137		$(this).height(hg);
138		if($(window).width()>1100){
139		$('.bx-viewport').height(hg);
140		$('.bx-wrapper').height(hg);
141		}
142	})
143	var footer = $('footer').outerHeight(true);
144	var min= hg-(link+footer);
145	console.log('min :'+min);
146
147	$('.page-content').find('.home-banner .each-banner').each(function(){
148		// $(this).find('.right').height('');
149		// $(this).find('.parallax-part').height('');
150	})
151	setTimeout(function(){
152		$('.page-content').find('.home-banner .each-banner').each(function(){
153			var now =$(this).outerHeight(true);
154			console.log('now',now);
155			if ( now < min){
156				// $(this).find('.right').height(min);
157				// $(this).find('.parallax-part').height(min);
158			}
159		})
160	},0)
161	
162}
163
164function SliderBg(){
165	$('.parallax-part').find('.block-parallax .block-form').each(function(){
166		var hg = $(window).height();
167		var right = $('.first .right').outerHeight(true);
168		//console.log('right : '+right);
169		var src = $(this).find('img').attr('src');
170		$(this).css('background-image','url('+src+')');			
171		$(this).css('background-position','center');			
172		$(this).css('background-size','cover');			
173		$(this).find('img').css('display','none');			
174		$(this).height(right);			
175	});
176
177}
178
179function scroll_shirnk(){
180    $(window).scroll(function() {
181		if($(window).width()>1100){
182			var h =$('.link-slide>div').outerHeight(true);
183			var wH = $(window).height();
184			var size = wH-h;
185			// console.log('wH-h : '+size);
186			//var Banner = $('.home-slider').height();
187			var scroll = getCurrentScroll();
188			var head=$('header .header .main-menu .menu-side li').outerHeight(true);
189			// console.log(scroll+' > '+scroll);
190			if (scroll >= wH-h) {
191				$('.link-slide .slide-block.initial').addClass('shrink');
192				$('.no-edit .link-slide').addClass('static');
193				// $('.link-slide .slide-block:first-of-type').addClass('active');
194			} else { 
195				$('.link-slide .slide-block.initial').removeClass('shrink');
196				$('.no-edit .link-slide').removeClass('static');
197			}			
198		}
199
200    });
201	
202    function getCurrentScroll() {
203        return window.pageYOffset; 
204    }
205}
206function slideHeight(){
207	// if(!edit){
208	// 	var wh = $(window).height();
209
210	// 	if($(window).width()>1024){
211	// 		$('.home-banner').height(wh);
212	// 		$('.home-banner .each-slide').height(wh);
213	// 		$('.home-banner .bx-wrapper .bx-viewport').height(wh);				
214	// 	}else if($(window).width() <= 1024 && $(window).width() > 680){
215	// 		$('.home-banner').height(wh/1.5);
216	// 		$('.home-banner .each-slide').height(wh/1.5);
217	// 		$('.home-banner .bx-wrapper .bx-viewport').height(wh/1.5);
218	// 	}else{
219	// 		$('.home-banner').height('');
220	// 		$('.home-banner .each-slide').height('');
221	// 		$('.home-banner .bx-wrapper .bx-viewport').height('');
222	// 	}
223	
224	// }
225
226}
227
228function getBackground(){
229	$('.first .parallax-part').each(function(){
230		var $src = $(this).find('img').attr('src');
231		$(this).css('background-image','url('+$src+')');
232	});
233}
234function pageMargin(){
235	if(!edit){
236		var wh = $(window).height();
237		$('.main-content').css('margin-top',wh);
238	}
239}
240function addDataSr(){ 
241		$('.first .head').attr('data-sr','enter top over 1s and move 10px wait 0.1s');
242		$('.first .content').attr('data-sr','enter bottom over 1s and move 10px wait 0.1s');
243		$('.section .text').attr('data-sr','enter left over 1s and move 10px wait 0.1s');
244		$('.section .img').attr('data-sr','enter right over 1s and move 10px wait 0.1s');
245	}
246
247
248});

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.