PageSourceSearch

https://shop.playkfa.com/static/js/lib.js

js playkfa.com collected 2026-09-24 12:27:19 UTC 10,669 bytes, 398 lines download raw bytes

1$(function() {
2	var $w = $(window),
3		$footer = $('footer'),
4		$banner = $('.kakao_link'),
5		offset = 20; // 20px를 빼줄 값
6
7	$w.on('scroll', function() {
8		var sT = $w.scrollTop();
9		var val = $(document).height() - $w.height() - $footer.outerHeight() + offset;
10
11		if (sT >= val) {
12			$banner.addClass('on');
13			// .kakao_link에 margin-bottom 설정
14			$banner.css('margin-bottom', $footer.outerHeight());
15		} else {
16			$banner.removeClass('on');
17			// on 클래스가 제거되면 margin-bottom 초기화
18			$banner.css('margin-bottom', 0);
19		}
20	});
21
22	var owl01 = $('.carousel.t1');
23	var owl02 = $('.carousel.t2');
24	var owl03 = $('.carousel.t3');
25	var owl04 = $('.carousel.t4');
26	var owl05 = $('.carousel.t5');
27	var owl06 = $('.carousel.t6');
28	var owl07 = $('.carousel.t7');
29	var owl08 = $('.carousel.t8');
30
31	// 메인 팝업 슬라이드
32	owl01.owlCarousel({
33		autoplay:true,
34		autoplayTimeout:5000,
35		items:1,
36		responsiveClass:true,
37		nav:false,
38		loop:true
39	});
40
41	// 메인 상단 팝업
42	owl02.owlCarousel({
43		autoplay:true,
44		autoplayTimeout:5000,
45		items:1,
46		responsiveClass:true,
47		nav:false,
48		loop:true,
49		onInitialized:counter, //When the plugin has initialized.
50		onTranslated:counter //When the translation of the stage has finished.
51	});
52
53	// 메인 상단 팝업
54	owl03.owlCarousel({
55		autoplay:true,
56		autoplayTimeout:5000,
57		items:1,
58		nav:false
59	});
60
61	// 메인 히어로 밑 티켓 슬라이드
62	owl04.owlCarousel({
63		autoplay:true,
64		autoplayTimeout:6000,
65		items:1,
66		responsiveClass:true,
67		nav:false,
68		loop:true,
69		onInitialized:counter,
70		onTranslated:counter
71	});
72
73	// 메인 인기상품 슬라이드
74	owl05.owlCarousel({
75		stagePadding:17,
76		items:1,
77		responsiveClass:true,
78		nav:false,
79		loop:true,
80		margin:-10
81	});
82
83	// 메인 할인상품 슬라이드
84	owl06.owlCarousel({
85		items:1,
86		responsiveClass:true,
87		nav:false,
88		loop:true,
89		margin:10
90	});
91
92	// 메인 인기샵 슬라이드
93	owl07.owlCarousel({
94		stagePadding:-67.5,
95		autoplay:true,
96		autoplayTimeout:5000,
97		items:3,
98		responsiveClass:true,
99		nav:false,
100		loop:true,
101		margin:10
102	});
103
104	// 상품 view페이지 상단 이미지 슬라이드
105	owl08.owlCarousel({
106		autoplay:false,
107		items:1,
108		nav:false,
109		loop:false,
110		onInitialized:counter,
111		onTranslated:counter
112	});
113
114
115	new Swiper('.swiper', {
116		slidesPerView:7
117	});
118
119	function counter(event) {
120		var element = event.target; // DOM element, in this example .owl-carousel
121		var items = ("0" + event.item.count).slice(-2); // Number of items formatted as "04"
122		var item = ("0" + (event.item.index + 1)).slice(-2); // Position of the current item formatted as "04"
123
124		// If loop is true then reset counter from 1
125		if (item > items) {
126			item = ("0" + (item - items)).slice(-2);
127		}
128
129		$(element).parent().find('.owl_counter').html('<span>' + item + '</span> / ' + items);
130	}
131
132
133	document.addEventListener('scroll', function () {
134		var header = document.getElementById('header');
135		var scrollY = window.scrollY || window.pageYOffset;
136
137		// 스크롤 위치에 따라 클래스 토글
138		if (scrollY > 10) {
139			header.classList.add('on');
140		} else {
141			header.classList.remove('on');
142		}
143	});
144
145	function hnmOpen() {
146		var top_banner = $('.top_banner');
147		var header = $('#header');
148		var hnmWrap = $('.hnm_wrap');
149		var allbody = $('body');
150
151		// Add 'on' class to .top_banner and 'open' class to both id="header" and class="hnm_wrap"
152		top_banner.addClass('on');
153		header.addClass('open');
154		hnmWrap.addClass('open');
155		allbody.addClass('scroll');
156	}
157
158	function hnmClose() {
159		var top_banner = $('.top_banner');
160		var header = $('#header');
161		var hnmWrap = $('.hnm_wrap');
162		var allbody = $('body');
163
164		// Remove 'on' class from .top_banner and 'open' class from both id="header" and class="hnm_wrap"
165		top_banner.removeClass('on');
166		header.removeClass('open');
167		hnmWrap.removeClass('open');
168		allbody.removeClass('scroll');
169	}
170
171	// 버튼 클릭 이벤트 등록
172	$('.hn_icon.hn_menu_btn').on('click', hnmOpen);
173	$('.hn_close').on('click', hnmClose);
174
175	// header 스크롤 다운시 on 추가
176	$(window).on("scroll", function () {
177		var scTop = $(window).scrollTop();
178		if (scTop > 50) {
179			$("#header").addClass("on");
180		} else {
181			$("#header").removeClass("on");
182		}
183	});
184
185	function tbannerClose() {
186		var topBanner = $('.top_banner');
187
188		// Add 'close' class to .top_banner
189		topBanner.addClass('close');
190	}
191
192	// Click event for the button
193	$('.tb_close button').on('click', tbannerClose);
194
195
196	$(document).ready(function() {
197		$('.date_list .swiper .swiper-slide dd').click(function() {
198			// Remove mark class from all dd elements
199			$('.date_list .swiper .swiper-slide dd').removeClass('mark');
200
201			// Add mark class to the clicked dd element
202			$(this).addClass('mark');
203		});
204	});
205
206	// 초기 설정
207	$('.cmn_tab.t1').addClass('on');
208	$('.btn_new').addClass('active');
209
210	// 버튼 클릭 이벤트
211	$('.btn_wrap button').click(function () {
212		// 모든 버튼에서 active 클래스 제거
213		$('.btn_wrap button').removeClass('active');
214		// 클릭한 버튼에 active 클래스 추가
215		$(this).addClass('active');
216
217		// 모든 탭에서 on 클래스 제거
218		$('.cmn_tab').removeClass('on');
219		// 해당하는 탭에 on 클래스 추가
220		if ($(this).hasClass('btn_new')) {
221			$('.cmn_tab.t1').addClass('on');
222		} else if ($(this).hasClass('btn_rec')) {
223			$('.cmn_tab.t2').addClass('on');
224		}
225	});
226
227	// p를 클릭할 때마다 on 클래스를 토글
228	$('#footer .f_info > p').click(function () {
229		$(this).toggleClass('on');
230	});
231
232	// #navi .hn_menu .hnm_list > li > div > p을 클릭할 때마다 on 클래스를 토글
233	$('#navi .hn_menu .hnm_list > li > div > p').click(function (e) {
234		e.preventDefault(); // 기본 동작을 막음 (예:링크로 이동하는 동작)
235
236		// 클릭한 span에 on 클래스가 이미 있으면 제거, 없으면 추가
237		$(this).parent().parent().toggleClass('on');
238
239		// 다른 span에는 on 클래스 제거
240		$('#navi .hn_menu .hnm_list > li > div > p').not(this).parent().parent().removeClass('on');
241	});
242
243	// .main_popup .mp_btn .p_close을 클릭할 때마다 .main_popup에 .close 클래스를 추가
244	$('.main_popup .mp_btn .p_close').click(function () {
245		$('.main_popup').addClass('close');
246	});
247
248	$('.main_popup .mp_btn .p_hide').click(function () {
249		$('.main_popup').addClass('close');
250	});
251
252
253
254	function goBack() {
255		window.history.back();
256	}
257
258	// "이전으로" 버튼 클릭 시 goBack 함수 호출
259	$('.btn_prev').on('click', goBack);
260
261
262
263	// 버튼 클릭 시 최상단으로 부드럽게 스크롤
264	$('#btn_top').on('click', function() {
265		$('html, body').animate({scrollTop:0}, 'slow');
266	});
267
268
269	// btn_search 클릭시 검색 팝업 close 제거, sp_close 클릭시 close 추가
270	$(document).ready(function() {
271		$(".btn_search").click(function() {
272			$(".search_popup").removeClass("close");
273		});
274
275		// .sp_close 클릭 시
276		$(".search_popup .sp_close").click(function() {
277			$(".search_popup").addClass("close");
278		});
279
280
281		// 정렬(최근 등록순) 버튼 클릭 시
282		$(".bs_btn.item_sort").click(function() {
283			$(".bottom_sheet").addClass("open");
284		});
285
286		// 구매 버튼 클릭 시
287		$(".btn_purchase.fool_btn").click(function() {
288			// bottom_sheet에 open 클래스를 추가하여 보이도록 함
289			$(".bottom_sheet").addClass("open");
290			// 구매 버튼은 안 보이게 함
291			$(".btn_purchase.fool_btn").hide();
292			$(".half_btn").show();
293		});
294
295		if($(".bottom_sheet").hasClass("open")) {
296		} else {
297			$(".half_btn").hide();
298			$(".btn_purchase.fool_btn").show();
299		}
300	});
301
302	// bottom_sheet에 input[name="sortType"] 선택시 open 제거하여 닫기
303	$('input[name="sortType"]').change(function() {
304		var selectedText = $(this).val();
305
306		if(selectedText == 4) {
307			$('.bs_btn').html('최근 등록순<i></i>');
308		} else if (selectedText == 2) {
309			$('.bs_btn').html('낮은 가격순<i></i>');
310		} else if (selectedText == 3) {
311			$('.bs_btn').html('높은 가격순<i></i>');
312		} else if (selectedText == 5) {
313			$('.bs_btn').html('인기 상품순<i></i>');
314		}
315		$('.bottom_sheet').removeClass('open');
316		$('body').css('overflow', 'auto');
317	});
318
319	// bottom_sheet close 버튼 클릭시 bottom_sheet에서 open 클래스 제거
320/*
321	$('#contents .bottom_sheet .bottom_sheet_title , #contents .bottom_sheet .bs_close').click(function() {
322		$('.bottom_sheet').removeClass('open');
323		$('body').css('overflow', 'auto');
324	});
325
326	// bottom_sheet close 버튼 클릭시 bottom_sheet에서 open 클래스 제거
327	$('#contents .bottom_sheet .bottom_sheet_title , #contents .bottom_sheet .bs_close_option').click(function() {
328		$('.bottom_sheet').removeClass('open');
329		$('body').css('overflow', 'auto');
330		$(".half_btn").hide();
331		$(".btn_purchase.fool_btn").show();
332	});
333*/
334	$('.bottom_sheet').on('click', function(e) {
335		var bottomSheetWrap = $(this).find('.bottom_sheet_wrap');
336
337		// If bottom_sheet is open and clicked element is not within bottom_sheet_wrap
338		if ($(this).hasClass('open') && !bottomSheetWrap.is(e.target) && bottomSheetWrap.has(e.target).length === 0) {
339			// Perform desired actions here
340			// For example:
341			$(this).removeClass('open');
342			$('body').css('overflow', 'auto');
343			$(".half_btn").hide();
344			$(".btn_purchase.fool_btn").show();
345		}
346	});
347
348
349
350	// dropdown 버튼 클릭시 dropdown에 클래스 "on" 추가
351	$('.dropdown .dropbtn').click(function() {
352		const dropdown = $(this).parent();
353		dropdown.toggleClass('on');
354	});
355
356	// 탭 버튼 클릭시 탭 내용 표시
357	$('.simpletab_btn').click(function() {
358		const tabId = $(this).data('tab');
359
360		// 모든 탭 버튼과 탭 컨텐츠 숨기기
361		$('.simpletab_btn').removeClass('on');
362		$('.simpletab_content').removeClass('on');
363
364		// 클릭된 탭 버튼 활성화 및 해당 탭 컨텐츠 표시
365		$(this).addClass('on');
366		$('#' + tabId).addClass('on');
367	});
368
369
370	// input 요소를 가져옴
371	var inputElements = document.querySelectorAll('.myinput');
372
373	// 모든 input 요소에 대해 반복
374	inputElements.forEach(function(inputElement) {
375		// input 요소에 input 이벤트 리스너를 추가
376		inputElement.addEventListener('input', function() {
377			// 입력값이 비어있는지 확인
378			if (inputElement.value.trim() === '') {
379				// 입력값이 비어있다면 배경색을 흰색(#fff)으로 변경
380				inputElement.style.backgroundColor = '#fff';
381			} else {
382				// 입력값이 있다면 배경색을 회색(#F6F6F6)으로 변경
383				inputElement.style.backgroundColor = '#F6F6F6';
384			}
385		});
386	});
387
388	$('.halftab_btn').click(function() {
389		const tabId = $(this).data('tab');
390
391		$('.halftab_btn').removeClass('on');
392		$('.halftab_content').removeClass('on');
393
394		$(this).addClass('on');
395		$('#' + tabId).addClass('on');
396	});
397});
398

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.