PageSourceSearch

https://ssupl.com/data/skin/front/19-07_C/js/gd_ui.js?ts=1629437685

js ssupl.com collected 2026-10-09 23:37:19 UTC 22,325 bytes, 628 lines download raw bytes

1$(function(){
2    if ($('#scroll_right, #scroll_left').length > 0) {
3        $('#scroll_right, #scroll_left').gb_quick_menu({
4            //HEADER_ID: '#header_warp'
5        });
6    }
7	// top으로 이동
8	$('.btn_scroll_top a').click(
9		function() {
10			$('html, body').stop().animate({scrollTop: $('body').offset().top}, 300);
11			return false;
12		}
13	);
14});
15
16$(function(){
17    var cateArray = new Array('','','','');
18    var arrayNum = 0;
19    var menupage = 0;
20    var total_width = $('.gnb_menu_box').innerWidth();
21    var gd_display_cate = function(){
22        var depth1 = 0;
23        $('.gnb_menu_box > ul > li').each(function(){
24            depth1 += $(this).innerWidth();
25            if(depth1 > total_width){
26                arrayNum++;
27                depth1 =0;
28                depth1 += $(this).innerWidth();
29                cateArray[arrayNum] += "<li>"+$(this).html()+"</li>";
30            }else{
31                cateArray[arrayNum] += "<li>"+$(this).html()+"</li>";
32            }
33        });
34        $('.gnb_menu_box > ul').html(cateArray[0]);
35        $('#header .gnb .depth0').css({
36            'overflow':'visible',
37            'height':'100%',
38        });
39    };
40    gd_display_cate();
41    /* 상단 메뉴 */
42    var gd_topmenu = function(){
43        $('.depth0 li').on({
44            'mouseover':function(){
45                $(this).find('> ul').stop(true,true).fadeIn('fast');
46                $(this).find('> a').addClass('active');
47                //console.log('open');
48            },
49            'mouseleave':function(){
50                $(this).find('> ul').stop(true,true).fadeOut('fast');
51                $(this).find('> a').removeClass('active');
52                //console.log('hide');
53            }
54        });
55    };
56    gd_topmenu();
57
58    /* 메뉴 우측 버튼 */
59    $('.gnb_right').on({
60        'click':function(){
61            if(arrayNum > menupage){
62                menupage++;
63                if(menupage == arrayNum) $(this).find('a').addClass('active');
64                $('.gnb_left').find('a').removeClass('active');
65                $('.gnb_menu_box > ul').html(cateArray[menupage]);
66                gd_topmenu();
67            }
68        }
69    });
70    /* 메뉴 좌측 버튼 */
71    $('.gnb_left').on({
72        'click':function(){
73            if(arrayNum >= menupage && menupage != 0){
74                menupage--;
75                if(menupage == 0) $(this).find('a').addClass('active');
76                $('.gnb_right').find('a').removeClass('active');
77                $('.gnb_menu_box > ul').html(cateArray[menupage]);
78                gd_topmenu();
79            }
80        }
81    });
82
83
84
85    /* 전체메뉴 버튼 */
86    /*
87    $('.gnb_all').on({
88        'click':function(){
89            if($('.gnb_allmenu').css('display') =='none') $('.gnb_allmenu').stop(true,true).slideDown('fast');
90            else $('.gnb_allmenu').slideUp('fast');
91
92        }
93    });
94    */
95
96    $ ( '.layer_type .sub_depth0 li'). on ({
97        'mouseover': function () {
98            $ (this) .find ( '> ul'). stop (true, true) .fadeIn ( 'fast');
99            $ (this) .find ( '> a'). addClass ( 'active');
100            //console.log('open ');
101        },
102        'mouseleave': function () {
103            $ (this) .find ( '> ul'). stop (true, true) .fadeOut ( 'fast');
104            $ (this) .find ( '> a'). removeClass ( 'active');
105            //console.log('hide ');
106        }
107    });
108
109
110    /* 해외몰 홈아이콘 타입 선택형(국기) */
111    $('.top_country_list1 .country_tit').on({
112        'click':function(){
113            if($(this).parent().find('ul').css('display') =='none'){
114                $(this).addClass('active');
115                $(this).parent().find('ul').slideDown('fast');
116            }else{
117                $(this).parent().find('ul').slideUp('fast');
118                $(this).removeClass('active');
119            }
120        }
121    });
122
123    /* 해외몰 홈아이콘 타입 선택형(국기,언어) */
124    $('.top_country_list2 .country_tit').on({
125        'click':function(){
126            if($(this).parent().find('ul').css('display') =='none'){
127                $(this).addClass('active');
128                $(this).parent().find('ul').slideDown('fast');
129            }else{
130                $(this).parent().find('ul').slideUp('fast');
131                $(this).removeClass('active');
132            }
133        }
134    });
135
136    /* location 경로 */
137    $('.location_select').on({
138        'mouseenter':function() {
139            if ($(this).find('ul').css('display') == 'none') {
140                $(this).find('.location_tit').addClass('active');
141                $(this).find('ul').slideDown('fast');
142            }
143        },
144        'mouseleave':function() {
145            $(this).find('ul').slideUp('fast');
146            $(this).find('.location_tit').removeClass('active');
147        }
148    });
149
150    /* 상단 마이페이지 레이어 */
151    $('.top_mypage_cont').on({
152        'mouseenter':function(){
153            if($(this).find('ul').css('display') =='none'){
154                $(this).find('.top_mypage_tit').addClass('active');
155                $(this).find('ul').show();
156            }
157        },
158        'mouseleave':function(){
159            $(this).find('ul').hide();
160            $(this).find('.top_mypage_tit').removeClass('active');
161        }
162    });
163
164    /* 상단 검색 */
165    $('.top_search_cont input[name="keyword"]').on({
166        'focus':function(){
167            if($("input[name=recentCount]").val() > 0) {
168                $(this).parents().find('.search_cont').show();
169            }
170        },
171        'blur':function(){
172            $('body').click(function(e){
173                if (!$('.search_cont').has(e.target).length && e.target.name != 'keyword') {
174                    $(this).parents().find('.search_cont').hide();
175                }
176            });
177            $('.btn_top_search_close').click(function(){
178                $(this).parents().find('.search_cont').hide();
179            });
180        }
181    });
182
183    /* 레이어, 추가 내용 */
184    $('.btn_common_box, .btn_layer').find('a').on({
185        'click':function(e){
186            var tg = $(this).attr('href');
187            if(tg.substr(0, 1) == '#'){
188                e.preventDefault();
189                if($(tg).css('display') == 'none'){
190                    $(tg).show();
191                    $(tg).find('.ly_close').attr('href',tg);
192                }else{
193                    $(tg).hide();
194                }
195            }
196        }
197    });
198    $('.ly_close').on({
199        click:function(){
200            var tg = $(this).attr('href');
201            if (tg.substr(0, 1) == '#') {
202                $(tg).hide();
203            }
204
205            if ($(this).parents('.js_password_layer').length) {
206                $('.js_password_layer').find('input[name="writerPw"]').val('');
207            }
208        }
209    });
210});
211
212function gd_btn_all_menu_close(){
213    $('.gnb_allmenu').slideUp('fast');
214}
215
216$(document).ready(function() {
217    /* 퀵검색 */
218    var qs_id = $('#quick_search');
219    var cname = qs_id.attr('class');
220    var position, position_m;
221
222    if(cname == 'q_left'){
223        position = qs_id.innerWidth();
224        qs_id.css('left','-'+position+'px');
225    }else if(cname == 'q_right'){
226        position = qs_id.innerWidth();
227        qs_id.css('right','-'+position+'px');
228    }else{
229        position = qs_id.innerHeight();
230        qs_id.css('top','-'+position+'px');
231    }
232    position_m = position;
233
234    function gd_quick_motion(){
235        if(cname == 'q_left'){
236            if(qs_id.css('left') == '0px') position_m = '-'+ position;
237            else position_m = 0;
238
239            qs_id.animate({
240            left : position_m
241            }, 500, function(){
242                //console.log(position_m);
243            });
244        }else if(cname =='q_right'){
245            if(qs_id.css('right') == '0px') position_m = '-'+ position;
246            else position_m = 0;
247
248            qs_id.animate({
249            right : position_m
250            }, 500, function(){
251                //console.log(position_m);
252            });
253        } else {
254            if(qs_id.css('top') == '0px') position_m = '-'+ position;
255            else position_m = 0;
256
257            qs_id.animate({
258            top : position_m
259            }, 500, function(){
260                //console.log(position_m);
261            });
262
263        }
264        if(position_m == 0) $('.quick_search_cont').addClass('on');
265        else $('.quick_search_cont').removeClass('on');
266    }
267    $('#quick_search .btn_quick_search_open, #quick_search .btn_quick_search_close').on({
268        'click':function(){
269            gd_quick_motion();
270        }
271    });
272
273    /* 퀵검색 컬러 & 혜택조건 */
274    $('.color_box span label, .benefit_box span label').on({
275        'click':function(){
276            if(!$(this).parent().find('input').is(':checked')) $(this).addClass('active');
277            else $(this).removeClass('active');
278        }
279    });
280
281	$('.btn_all_menu_open').on('click',function(){
282        gd_btn_all_menu_open();
283    });
284
285});
286
287// 레이어박스 센터정렬 플러그인 (최상단)
288jQuery.fn.center = function() {
289    var top = ($(window).height() - this.outerHeight()) / 2;
290    var left = ($(window).width() - this.outerWidth()) / 2;
291
292    this.css({
293        position:'absolute',
294        margin:0,
295        top: (top > 0 ? top : 0) + 'px',
296        left: (left > 0 ? left : 0) + 'px'
297    });
298
299    return this;
300};
301
302// 레이어박스 센터정렬 플러그인 (현재위치)
303jQuery.fn.currentCenter = function() {
304    this.css({
305        'position': 'fixed',
306        'left': '50%',
307        'top': '50%'
308    });
309
310    this.css({
311        'margin-left': -this.outerWidth() / 2 + 'px',
312        'margin-top': -this.outerHeight() / 2 + 'px'
313    });
314
315    return this;
316};
317
318/* 스크롤배너(오른쪽) */
319(function (){
320   $.fn.gb_quick_menu = function(options){
321      //초기값
322      var defaults = {
323         HEADER_ID: '.scroll_wrap',
324         FIXED_CLS: 'ban_fixed',
325         FIXED_SIZE :1450,
326         LEFT_QUICK_ID : '#scroll_left',
327         CONTENTS_WARP : '#wrap',
328      };
329      //초기값 옵션 배열 저장
330      var options = $.extend({}, defaults, options);
331      var el = $(this);
332      var scqTop = 0;
333      var quickTop = $(options.HEADER_ID).offset().top-136;
334      var qucik_left = $(options.LEFT_QUICK_ID).css('left');
335
336        $(window).on({
337            'resize':function(){
338
339            },
340            'scroll':function(){
341                var win_width = $(window).innerWidth();
342                scqTop = $(this).scrollTop();
343                if(scqTop <= quickTop){
344                    el.removeClass(options.FIXED_CLS).removeAttr('style');
345                }else{
346                    if(win_width > options.FIXED_SIZE){
347                        el.addClass(options.FIXED_CLS).removeAttr('style');
348                    }else{
349                        el.removeClass(options.FIXED_CLS).removeAttr('style');
350                        el.stop(true,true).css('top', (scqTop-quickTop+20));
351
352                    }
353                }
354            }
355        });
356        var gd_leftmove = function(){
357            var win_width = $(window).innerWidth();
358            if(win_width <= options.FIXED_SIZE){
359                gd_left_animate(qucik_left);
360            }else{
361                gd_left_animate(0);
362            }
363        };
364        var gd_left_animate = function(left_quick_position){
365            $('#wrap').stop(true,true).animate({
366                'marginLeft':left_quick_position,
367            },'5000',function(){
368
369            });
370        };
371        $(window).load(function(){
372        
373        })
374   };
375})(jQuery);
376
377// 체크박스 처리 로직 초기화
378function gd_init_checkbox_ui() {
379    $(document).on('click', 'input[type=radio]', function(e){
380        $(this).parents('form:first').find("input[name='" + $(this).prop("name") + "']").each(function() {
381            if ($(this).prop("checked")) {
382                $("label[for=" + $(this).attr("id") + "]").addClass("on");
383            } else {
384                $("label[for=" + $(this).attr("id") + "]").removeClass("on");
385            }
386        });
387    });
388
389    $(document).on('click', 'input[type=checkbox]', function(e){
390        if($(this).prop('readonly') === false) {
391            if($(this).prop("checked")) {
392                $("label[for="+$(this).attr("id")+"]").addClass("on");
393            } else {
394                $("label[for="+$(this).attr("id")+"]").removeClass("on");
395            }
396        } else {
397            e.preventDefault();
398        }
399    });
400}
401
402// 라디오박스,체크박스 이미지화 스크립트
403function gd_trigger_checkbox_ui() {
404    var $input = $('input[type=radio], input[type=checkbox]');
405    // 템플릿에서 check 처리한 경우 예외처리 추가
406    if(!$input.find('label.on')){
407        $input.each(function(){
408            var $item = $("label[for="+$(this).attr("id")+"]");
409            if($(this).prop("checked")) {
410                $item.addClass("on");
411            } else {
412                $item.removeClass("on");
413            }
414        });
415    }
416}
417
418// 체크박스 전체 선택
419function gd_checkbox_all() {
420    // 체크박스 전체 선택 이벤트
421    if ($(':checkbox.gd_checkbox_all').length > 0) {
422        // 이벤트 중복 실행을 막아준다.
423        $(':checkbox.gd_checkbox_all').off('click');
424        $(':checkbox.gd_checkbox_all').click(function (e) {
425            var $target = $(e.target);
426            var targetName = $target.data('target-name');
427            var targetId = $target.data('target-id');
428            var targetFormName = $target.data('target-form');
429            if (typeof targetFormName == 'undefined') targetFormName = "";
430            if (_.isUndefined(targetId)) {
431                $(targetFormName + ' :checkbox[name="' + targetName + '"]').prop('checked', !$target.prop('checked')).trigger('click');
432            } else {
433                $(targetFormName + ' :checkbox[id*="' + targetId + '"]').prop('checked', !$target.prop('checked')).trigger('click');
434            }
435        });
436    }
437}
438
439// 레이어 박스 이벤트
440function gd_center_layer(){
441    //$('.btn_open_layer').off('click');
442    $(document).on('click', '.btn_open_layer', function() {
443		// cre.ma / 레이어 차단 시작 / 스크립트를 수정할 경우 연락주세요 ([email protected])
444		if($(this).is(':not(.crema-new-review-link,.crema-applied)')){
445			// @qnibus 레이어 안에 레이어가 있는 경우 종속된 보이지 않는 레이어가 이미 떠있는 레이어 기준으로 center 처리 되어 보여져 레이아웃이 깨짐
446			$('.layer_wrap').removeAttr('style');
447			$('body').css('overflow','hidden');
448			var target = $(this).attr('href');
449			$(target).removeClass('dn');
450			$('#layerDim').removeClass('dn');
451			$(target).find('> div').center();
452
453			return false;
454		}
455		// cre.ma / 레이어 차단 끝 / 스크립트를 수정할 경우 연락주세요 ([email protected])
456    });
457
458    $(document).on('click', '.layer_wrap .layer_close, .btn_box .btn_cancel', function(){
459        $(this).closest('.layer_wrap').addClass('dn');
460        // 창이 2개 이상 떠있는 경우 Dim처리 안되게
461        if (!$('.layer_wrap').is(':visible')) {
462            $('#layerDim').addClass('dn');
463			$('body').removeAttr('style');
464        }
465        return false;
466    });
467}
468
469// 레이어 박스 창닫기 (현재 열려 있는 창만 닫는다)
470function gd_close_layer() {
471    if ($('.layer_wrap').is(':visible') || $('#layerDim').is(':visible')) {
472        if ($('.layer_wrap .layer_close, .btn_box .btn_cancel').length > 0) {
473            $('.layer_wrap .layer_close, .btn_box .btn_cancel').trigger('click');
474        } else {
475            // 딤만 떠있는 경우
476            $('.layer_wrap').addClass('dn');
477            $('#layerDim').addClass('dn');
478        }
479    }
480}
481
482// chosen 셀렉트 박스
483function gd_select_remodeling() {
484    var selector = '.chosen-select';
485    var config = {
486        disable_search_threshold: 10,
487        no_results_text: __('검색결과가 없습니다.')
488    };
489
490    if ($(selector).length > 0) $(selector).chosen(config);
491}
492
493// 카트탭 레이어
494function gd_carttab_layer() {
495    $('.cart_tab_list li > a').on({
496        'click':function() {
497            if ($(this).hasClass('btn_alert_login') == false) {
498                $('.btn_shop_cart_box .btn_shop_cart_close').show();
499                $(this).parent().addClass('on').siblings().removeClass('on');
500                $('#shop_cart_wrap .shop_cart_cont > .cart_tab_box').eq($(this).index()).fadeIn('fast').siblings().removeClass('on').hide();
501                $('.shop_cart_cont').slideDown('fast');
502                gd_cart_tab_action($(this).attr('href'));
503            }
504        }
505    });
506
507    $('.btn_shop_cart_box .btn_shop_cart_open, .btn_shop_cart_box .btn_shop_cart_close').on({
508        'click':function() {
509            if ($('.shop_cart_cont').css('display') != 'none') {
510                $('.shop_cart_cont').slideUp('fast');
511                $('.btn_shop_cart_box .btn_shop_cart_close').hide();
512                $('.btn_shop_cart_box .btn_shop_cart_open').show();
513                $('.cart_tab_list li').removeClass('on');
514            } else {
515                $('.cart_tab_list li').eq(0).addClass('on');
516                $('.cart_tab_box').eq(0).addClass('on');
517                $('.shop_cart_cont').slideDown('fast');
518                $('.btn_shop_cart_box .btn_shop_cart_close').show();
519                $('.btn_shop_cart_box .btn_shop_cart_open').hide();
520                $('#shop_cart_wrap .shop_cart_cont > .cart_tab_box').hide().eq(0).fadeIn('fast');
521                gd_cart_tab_action('#cart_tab_today');
522            }
523
524            $('.chart_view_horizontal ul').slick('reinit');
525        }
526    });
527}
528
529// 파일첨부 꾸미기
530function gd_file_attach() {
531    $(document).on('change', '.file_upload_sec .file', function(){
532        var i = $(this).val();
533        $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i);
534    });
535}
536
537/*
538 카테고리/브랜드 카테고리 마우스 오버
539 */
540function gd_menu_over() {
541
542    $(document).on('mouseenter mouseleave', 'img.gd_menu_over', function (event) {
543        $(this).attr({
544            src: $(this).attr('data-other-src')
545            , 'data-other-src': $(this).attr('src')
546        });
547
548    });
549
550    $(document).on('mouseenter', 'span.gd_menu_over', function (event) {
551        var width = $(this).closest("strong").width();
552        var height = $(this).closest("strong").height() - 7;
553        $(this).html("<img src='" + $(this).data('other-src') + "' style='max-width:" + width + "px;max-height:" + height + "px'>");
554
555    });
556
557    $(document).on('mouseleave', 'span.gd_menu_over', function (event) {
558        $(this).html($(this).data('other-text'));
559    });
560}
561
562function gd_btn_all_menu_open(){
563
564    $.ajax({
565        method: "POST",
566        cache: false,
567        url: "../goods/goods_ps.php",
568        data: "mode=get_all_category",
569        success: function(data) {
570            var getData = $.parseJSON(data);
571            if(data =='false') {
572                $(".gnb_allmenu_box").html('');
573            }else{
574                var addHtml = '<div class="gnb_allmenu" style="display:none;"><div class="gnb_allmenu_box">'
575                addHtml += '<ul>';
576                $.each(getData, function (categoryKey, categoryVal) {
577                    $.each(categoryVal, function (key, val) {
578                        addHtml += '<li style="width:20%;"><div class="all_menu_cont"><a href="../goods/goods_list.php?cateCd='+val.cateCd+'">'+val.cateNm+'</a>';
579                        if(val.children) {
580                            addHtml += '<ul class="all_depth1">';
581                            $.each(val.children, function (key1, val1) {
582                                addHtml += '<li><a href="../goods/goods_list.php?cateCd='+val1.cateCd+'">'+val1.cateNm+'</a>';
583                                if(val1.children) {
584                                    addHtml += '<ul class="all_depth2">';
585                                    $.each(val1.children, function (key2, val2) {
586                                        addHtml += '<li><a href="../goods/goods_list.php?cateCd='+val2.cateCd+'">'+val2.cateNm+'</a>';
587                                        if(val2.children) {
588                                            addHtml += '<ul class="all_depth3">';
589                                            $.each(val2.children, function (key3, val3) {
590                                                addHtml += '<li><a href="../goods/goods_list.php?cateCd='+val3.cateCd+'">'+val3.cateNm+'</a></li>';
591                                            });
592                                            addHtml += '</ul>';
593                                        }
594                                        addHtml += '</li>';
595                                    });
596                                    addHtml += '</ul>';
597                                }
598                                addHtml += '</li>';
599                            });
600                            addHtml += '</ul>';
601                        }
602                        addHtml += '</div></li>';
603                    });
604                });
605                addHtml += '</ul>';
606                addHtml += '</div><span class="btn_all_menu_close" onClick="gd_btn_all_menu_close();">전체메뉴닫기</span></div>'
607                $(".gnb_allmenu_wrap").html(addHtml);
608                $('.gnb_allmenu').stop(true,true).slideDown('fast');
609            }
610        },
611        error: function (data) {
612            alert(data.message);
613        }
614    });
615
616};
617
618// 함수 호출
619$(document).ready(function() {
620    gd_init_checkbox_ui();
621    gd_trigger_checkbox_ui();
622    gd_checkbox_all();
623    gd_center_layer();
624    gd_carttab_layer();
625    gd_select_remodeling();
626    gd_file_attach();
627	gd_menu_over();
628});

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.