PageSourceSearch

https://wendellyu.com/static/js/style_d/script.js?1790861584

js wendellyu.com collected 2026-10-02 03:17:35 UTC 9,409 bytes, 396 lines download raw bytes

1$(function () {
2
3	function gototop() {
4		if ($(this).scrollTop() > 100) {
5			$('.fixed-bottom-contant').fadeIn("fast");
6			$(".navbar").addClass("fixed");
7		} else {
8			$('.fixed-bottom-contant').stop().fadeOut("fast");
9			$(".navbar").removeClass("fixed");
10		}
11	}
12
13	var headerHeight = $('header').outerHeight();
14
15	function mobileSticky() {
16		if ($(this).scrollTop() > headerHeight) {
17			$('.info-mobileTab ,.course-mobileTab').addClass("fixed-top");
18		} else {
19			$('.info-mobileTab ,.course-mobileTab').removeClass("fixed-top");
20		}
21	}
22	$(window).scroll(gototop);
23	$(window).scroll(mobileSticky);
24
25	// gotoTop============================
26	$("#gotop").click(function () {
27		$("html,body").animate({
28			scrollTop: 0
29		}, 500);
30		$("#share-btn").removeClass("open-btn").find('i').removeClass('fa-times').addClass('fa-share');
31		$(".share-page").removeClass("open-menu");
32	});
33
34	// share-btn============================
35	$("#share-btn").click(function () {
36		$(this).toggleClass("open-btn").find('i').toggleClass('fa-share fa-times');
37		$(".share-page").toggleClass("open-menu");
38	});
39
40	// ==========burger==========
41	$(".hamburger").click(function () {
42		$(this).toggleClass("is-active");
43	});
44
45	// ========== purchase popup==========
46	$(".fixed-bottom-popup .close-btn").click(function () {
47		$(this).parents(".fixed-bottom-popup").fadeOut("fast");
48	});
49
50	// handle zeynepjs overlay click
51	$('.overlayer').on('click', function () {
52		zeynep.close();
53		$(this).toggleClass("active");
54		$('.hamburger').toggleClass("is-active");
55	})
56
57	// open zeynepjs side menu
58	$('.hamburger').on('click', function () {
59		$('.zeynep').toggleClass("opened");
60		$('.overlayer').toggleClass("active");
61	})
62
63	// ========== 產品內頁規格燈箱及按鈕 ==========
64	// 用 document delegation 綁定,避免 PJAX 換頁後 #spec_list / .mobile-addcart-popup
65	// 換成新 DOM 時 handler 失效。寬度判斷在 handler 內現算,不用再 rebind。
66	$(document).on('click', '#spec_list', function () {
67		if ($(window).width() < 767) {
68			$(".mobile-addcart-popup").fadeIn("fast");
69			$(".popup-overlayer").fadeIn("fast");
70		}
71	});
72
73	$(document).on('click', '.mobile-addcart-popup > .popup-close, .popup-overlayer', function () {
74		$(".mobile-addcart-popup").fadeOut("fast");
75		$(".popup-overlayer").fadeOut("fast");
76	});
77
78	// ==========mobile選單換頁效果==========
79
80	// init zeynepjs side menu
81	var zeynep = $('.zeynep').zeynep();
82
83	// ==========郵遞區號==========
84	$('.twzipcode').twzipcode();
85	// 修 jquery-twzipcode init bug:zip+county+district 同時帶 data-value 時,plugin 末段 blur 反查會把使用者選的「北區/香山區」蓋成第一筆(300 → 新竹市東區)
86	$('.twzipcode').each(function(){
87		var $w=$(this),c=$w.find('[data-role=county]').data('value'),d=$w.find('[data-role=district]').data('value');
88		if(c){$w.find('[data-role=county] select').val(c).trigger('change.twzipcode');if(d)$w.find('[data-role=district] select').val(d);}
89	});
90	// ==========product-dispaly carousel==========
91	$('.my-carousel').carousel({
92		interval: 4000
93	});
94
95	// datepicker https://gijgo.com/datepicker/configuration ============================
96	$('#bookingdate').datepicker({
97		uiLibrary: 'bootstrap4',
98		format: 'yyyy-dd-mm',
99		locale: 'zh-tw',
100	});
101	// ==========col-4 slider==========
102	$('.col4-slider').slick({
103		infinite: true,
104		arrows: false,
105		dots: true,
106		slidesToShow: 4,
107		slidesToScroll: 4,
108		responsive: [{
109			breakpoint: 993,
110			settings: {
111				slidesToShow: 3,
112				slidesToScroll: 3
113			}
114		},
115		{
116			breakpoint: 768,
117			settings: {
118				arrows: false,
119				centerMode: true,
120				centerPadding: '20px',
121				slidesToShow: 2,
122				slidesToScroll: 2
123			}
124		},
125		{
126			breakpoint: 479,
127			settings: {
128				arrows: false,
129				dots: false,
130				centerMode: true,
131				centerPadding: '10px',
132				slidesToShow: 1,
133				slidesToScroll: 1
134			}
135		}
136		]
137	});
138
139	// ==========col-3 slider==========
140	$('.col3-slider').slick({
141		infinite: true,
142		arrows: false,
143		dots: true,
144		slidesToShow: 3,
145		slidesToScroll: 3,
146		responsive: [{
147			breakpoint: 993,
148			settings: {
149				slidesToShow: 3,
150				slidesToScroll: 3
151			}
152		},
153		{
154			breakpoint: 768,
155			settings: {
156				arrows: false,
157				centerMode: true,
158				centerPadding: '20px',
159				slidesToShow: 2
160			}
161		},
162		{
163			breakpoint: 479,
164			settings: {
165				arrows: false,
166				centerMode: true,
167				centerPadding: '10px',
168				slidesToShow: 1
169			}
170		}
171		]
172	});
173
174	// ==========col-2 slider==========
175	$('.col-2-slider').slick({
176		infinite: true,
177		arrows: false,
178		dots: true,
179		slidesToShow: 2,
180		slidesToScroll: 2,
181		responsive: [
182			{
183				breakpoint: 768,
184				settings: {
185					arrows: false,
186					centerMode: true,
187					centerPadding: '20px',
188					slidesToShow: 1
189				}
190			},
191			{
192				breakpoint: 479,
193				settings: {
194					centerPadding: '10px',
195				}
196			}
197		]
198	});
199
200	// ==========index-banner slider==========
201
202	$('.index-banner-for').slick({
203		slidesToShow: 1,
204		slidesToScroll: 1,
205		arrows: false,
206		dots: true,
207		fade: true,
208		infinite: true,
209		autoplay: true,
210		autoplaySpeed: 5000,
211		asNavFor: '.index-banner-nav'
212	});
213
214	$('.index-banner-nav').slick({
215		slidesToShow: 3,
216		slidesToScroll: 1,
217		asNavFor: '.index-banner-for',
218		arrows: false,
219		dots: false,
220		focusOnSelect: true
221	});
222
223	// ==========product-detail slider==========
224
225	$('.product-slider-for').slick({
226		slidesToShow: 1,
227		slidesToScroll: 1,
228		arrows: false,
229		fade: true,
230		asNavFor: '.product-slider-nav',
231	});
232
233
234	$('.product-slider-nav').slick({
235		slidesToShow: 3,
236		slidesToScroll: 1,
237		asNavFor: '.product-slider-for',
238		arrows: false,
239		dots: false,
240		focusOnSelect: true,
241		autoplay: true,
242		autoplaySpeed: 4000,
243	});
244
245
246	// ==========product-package slider==========
247	$('.pakage-slider').slick({
248		infinite: true,
249		arrows: true,
250		dots: false,
251		slidesToShow: 3,
252		slidesToScroll: 3,
253		responsive: [{
254			breakpoint: 993,
255			settings: {
256				slidesToShow: 3,
257				slidesToScroll: 3
258			}
259		},
260		{
261			breakpoint: 768,
262			settings: {
263				arrows: false,
264				centerMode: true,
265				centerPadding: '20px',
266				slidesToShow: 2,
267				slidesToScroll: 2,
268			}
269		}, {
270			breakpoint: 576,
271			settings: {
272				arrows: false,
273				centerMode: true,
274				centerPadding: '10px',
275				slidesToShow: 1,
276				slidesToScroll: 1,
277			}
278		}
279		]
280	});
281
282	// ==========首頁圖片瀑布流==========
283	// init Masonry
284	var $grid = $('.grid').masonry({
285		itemSelector: '.grid-item',
286		percentPosition: true,
287		columnWidth: '.grid-sizer'
288	});
289	// layout Masonry after each image loads
290	$grid.imagesLoaded().progress(function () {
291		$grid.masonry();
292	});
293
294	// ==========html5 audio ==========
295	// Get container width and height
296	var w = $('.audio-player').parent().width();
297	var h = $('.audio-player').parent().height();
298
299	$('.audio-player')
300	.attr('width', w)
301    .attr('height', h)
302    .delay( 500 )
303	.mediaelementplayer({
304		alwaysShowControls: true,
305		features: ['speed', 'skipback', 'jumpforward', 'playpause', 'volume', 'current', 'progress', 'duration'],
306		defaultAudioWidth: w,
307		defaultAudioHeight: h,
308		audioWidth: -1,
309		audioHeight: -1,
310		enableAutosize: true,
311	});
312
313	// ========== Sticky sidebar ==========
314	var sticky = new Sticky('.sticky');
315
316	// ========== event gotoBuy show ==========
317
318	function gotobuyEvent() {
319		if ($(window).width() < 767) {
320			$(window).scroll(function () {
321				var headerHeight = $('header').outerHeight() + $('.event-intro-header').outerHeight();
322				var scrollHeight = $(document).height();
323				var scrollPosition = $(window).height() + $(window).scrollTop();
324				var footerHeight = $('footer').outerHeight();
325				var scrollbottom = scrollHeight - scrollPosition;
326				if (scrollbottom >= footerHeight && $(window).scrollTop() >= headerHeight - 200) {
327					$('.event-footer .gotoID').fadeIn("fast");
328				}
329				else {
330					$('.event-footer .gotoID').fadeOut("fast");
331				}
332			});
333		}
334	};
335
336	function gotobuyCourse() {
337		if ($(window).width() < 767) {
338			$(window).scroll(function () {
339				var headerHeight = $('header').outerHeight() + $('.course-intro-header').outerHeight();
340				var scrollHeight = $(document).height();
341				var scrollPosition = $(window).height() + $(window).scrollTop();
342				var footerHeight = $('footer').outerHeight();
343				var scrollbottom = scrollHeight - scrollPosition;
344				if (scrollbottom >= footerHeight && $(window).scrollTop() >= headerHeight - 500) {
345					$('.course-intro-footer .gotoID').fadeIn("fast");
346				}
347				else {
348					$('.course-intro-footer .gotoID').fadeOut("fast");
349				}
350			});
351		}
352	};
353
354	$(window).resize(function () {
355		gotobuyEvent();
356		gotobuyCourse();
357	});
358	gotobuyEvent();
359	gotobuyCourse();
360
361});
362
363// ==== anchor scroll ID ====
364$(function () {
365	function scrollToAnchor(hash) {
366		var target = $(hash),
367			pcNavHeight = 0,
368			mobileNavHeight = 0; // Get fixed header height
369
370		target = target.length ? target : $('[name=' + hash.slice(1) + ']');
371
372		if ($(window).width() < 767) {
373			$('html,body').animate({
374				scrollTop: target.offset().top - mobileNavHeight
375			}, 1000);
376			return false;
377		}
378		else {
379			$('html,body').animate({
380				scrollTop: target.offset().top - pcNavHeight - 50
381			}, 1000);
382			return false;
383		}
384	}
385
386	if (window.location.hash) {
387		scrollToAnchor(window.location.hash);
388	}
389	$("#category-inner a[href*=\\#]:not([href=\\#])").click(function () {
390		if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') ||
391			location.hostname == this.hostname) {
392
393			scrollToAnchor(this.hash);
394		}
395	});
396});

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.