$(function(){ // 비주얼 $('.visual .slider').on('init reInit afterChange', function(event, slick, currentSlide, nextSlide){ var i = (currentSlide ? currentSlide : 0) + 1; var z = slick.slideCount; if (i < 10){ $('.visual .ctrl .current').text('0' + i); } else { $('.visual .ctrl .current').text(i); } if (z < 10){ $('.visual .ctrl .total').text('0' + slick.slideCount); } else { $('.visual .ctrl .total').text(slick.slideCount); } }); $('.visual .slider').slick({ slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 4000, prevArrow: $('.visual .ctrl .prev'), nextArrow: $('.visual .ctrl .next') }); $('.visual .ctrl .stop').on('click', function() { $(this).hide(); $('.visual .slider').slick('slickPause'); $('.visual .ctrl .play').show().focus(); }); $('.visual .ctrl .play').on('click', function() { $(this).hide(); $('.visual .slider').slick('slickPlay'); $('.visual .ctrl .stop').show().focus(); }); // 결혼서비스 $('.marriage ul>li .mrgBtn').attr('title', '축소됨'); $('.marriage ul>li').eq(0).addClass('on').find('.mrgBtn').attr('title', '확장됨'); $(document).on('click', '.marriage .mrgBtn', function(){ $('.marriage .mrgBtn').attr('title', '축소됨'); $(this).attr('title', '확장됨'); $('.marriage>ul>li').removeClass('on'); $(this).parent().addClass('on'); }); // 결혼서비스 예식장 - 탭 $hall_graph = $('.marriage .ms_hall .graphBox'); $hall_graphBtn = $('.marriage .ms_hall .btnBox>div'); $hall_graphBtn.eq(0).addClass('on').find('.graphBtn').attr('title', '선택됨'); $hall_graph.eq(0).addClass('on'); $(document).on('click', '.marriage .ms_hall .graphBtn', function(){ var inx = $(this).closest('div').index(); $hall_graphBtn.removeClass('on').find('.graphBtn').removeAttr('title'); $(this).attr('title', '선택됨').closest('div').addClass('on'); $hall_graph.removeClass('on'); $hall_graph.eq(inx).addClass('on'); }); // 주간 가격정보 - select 열기/닫기 $('.contsBox .priceBox').eq(0).addClass('on'); $(document).on('click', '.priceInfo .selectBtn .selected', function(){ if ($(this).is('.on')) { $(this).removeClass('on'); $(this).attr('title', '품목 닫힘'); $('.selectList').slideUp(); } else { $(this).addClass('on'); $(this).attr('title', '품목 열림'); $('.selectList').slideDown(); } }); // 주간 가격정보 - 품목 선택후 $(document).on('click', '.priceInfo .selectList button', function(){ var name = $(this).attr('data-name'); var inx = $(this).closest('li').index(); $('.priceInfo .selectBtn .selected span').text(name); $('.priceInfo .selectBtn .selected').removeClass('on').attr('title', '품목 닫힘'); $('.selectList').slideUp(); $('.priceInfo .selectBtn .selected').focus(); $('.priceInfo .contsBox .priceBox').removeClass('on') $('.priceInfo .contsBox .priceBox').eq(inx).addClass('on') $('.priceInfo .slider').slick('setPosition'); priceChart1($('.priceInfo .on .slider').find('.slick-slide').eq(0).find(".item")); priceChart2($('.priceInfo .on .slider').find('.slick-slide').eq(0).find(".item")); }); // 주간 가격정보 차트 function priceChart1(item){ $(".skipGraph1").html(item.data("skip1")); Highcharts.chart(item.data("chartname1"), { chart: { type: 'column', backgroundColor: '#fff'}, title: { text: '월간 그래프', style: { display: 'none' } }, xAxis: { categories: [ item.data("man5"), item.data("man4"), item.data("man3"), item.data("man2"), item.data("man1"), item.data("man0") ], lineColor: '#737373', labels: { style: { fontSize: '13px', color: '#33446c', lineHeight: '1.2'} }, }, yAxis: { title: {text: null }, tickAmount: 4, labels: { style: {color: '#000'}, formatter: function () { return Highcharts.numberFormat(this.value, 0, '.', ','); } }, gridLineColor: '#dce7f4', }, legend: { enabled: false }, plotOptions: { column: { borderColor: '#fff' }, series: { borderRadius: 6 } }, series: [{ name: item.data("name"), data: [ { y: item.data("map5"), color: '#767676' }, { y: item.data("map4"), color: '#767676' }, { y: item.data("map3"), color: '#767676' }, { y: item.data("map2"), color: '#767676' }, { y: item.data("map1"), color: '#767676' }, { y: item.data("map0"), color: '#2f7fed' } ] }], credits: {enabled: false}, // 버전 숨김 exporting: {enabled: false} // 이미지 저장 숨김 }); } function priceChart2(item){ $(".skipGraph2").html(item.data("skip2")); Highcharts.chart(item.data("chartname2"), { chart: { type: 'column', backgroundColor: '#fff' }, title: { text: '연간 그래프', style: {display: 'none'} }, xAxis: { categories: [ item.data("qan3"), item.data("qan2"), item.data("qan1"), item.data("qan0") ], lineColor: '#737373', labels: { style: { fontSize: '13px', color: '#33446c', lineHeight: '1.2' } }, }, yAxis: { title: {text: null}, tickAmount: 4, labels: { style: {color: '#000'}, formatter: function () { return Highcharts.numberFormat(this.value, 0, '.', ','); } }, gridLineColor: '#dce7f4', }, legend: { enabled: false }, plotOptions: { column: { borderColor: '#fff' }, series: { borderRadius: 6 } }, series: [{ name: item.data("name"), data: [ { y: item.data("qap3"), color: '#767676' }, { y: item.data("qap2"), color: '#767676' }, { y: item.data("qap1"), color: '#767676' }, { y: item.data("qap0"), color: '#2f7fed' } ] }], credits: {enabled: false}, // 버전 숨김 exporting: {enabled: false} // 이미지 저장 숨김 }); } // 주간 가격정보 - 슬라이드 $('.priceInfo .slider').each(function() { var $prev = $(this).parent().find('.ctrl .prev'); var $next = $(this).parent().find('.ctrl .next'); $(this).slick({ slidesToShow: 1, slidesToScroll: 1, infinite: true, fade: true, autoplay: false, prevArrow: $prev, nextArrow: $next }); }); priceChart1($('.priceInfo .on .slider').find('.slick-slide').eq(0).find(".item")); priceChart2($('.priceInfo .on .slider').find('.slick-slide').eq(0).find(".item")); $('.priceInfo .slider').on("afterChange", function(event, slick, currentSlide){ priceChart1(slick.$slides.eq(currentSlide).find(".item")); priceChart2(slick.$slides.eq(currentSlide).find(".item")); }); // 주간 가격정보 - 그래프 탭 $('.priceInfo .graph').each(function() { $(this).find('li').eq(0).addClass('on').find('.graphBtn').attr('title', '선택됨'); }); $(document).on('click', '.priceInfo .graphBtn', function(){ $(this).closest('.graph').find('.graphBtn').removeAttr('title'); $(this).attr('title', '선택됨'); $(this).closest('.graph').find('li').removeClass('on'); $(this).closest('li').addClass('on'); }); // 주요소식 $('.newsBtn div').eq(0).addClass('on').find('button').attr('title', '선택됨'); $('.newsConts > div').eq(0).addClass('on'); $('.newsBtn button').click(function () { const index = $(this).parent().index(); $('.newsBtn > div').removeClass('on'); $(this).parent().addClass('on'); $('.newsBtn button').removeAttr('title'); $(this).attr('title', '선택됨'); $('.newsConts > div').removeClass('on'); $('.newsConts > div').eq(index).addClass('on'); }); //할인정보 클릭 function mmm(name){ $("#sendFields").html(makeField("searchCondition06", 1)); $("#sendFields").append(makeField("searchKeyword2", name)); $("form[name='sendForm']").attr("action", "/tprice/portal/saleinfo/saleinfo/saleinfoList.do").submit(); } $.ajax({ type:"POST", url: "/tprice/portal/main/selectEtcInfo.do", dataType:"json", success:function(data){ saleGoods = data.saleInfo; popluarGoods = data.popluarGood; var txt = ''; var txt2 = ''; if(saleGoods.length > 0){ $("#dateweek").html(saleGoods[0].week); for(var i = 0; i < saleGoods.length; i++){ txt += '
'; txt += ''; txt += ''+saleGoods[i].entpName+''; txt += '
'; txt += ''+saleGoods[i].goodName+''; txt += ''+$.number(saleGoods[i].goodPrice) +'원'; txt += '
'; txt += ''; txt += '
'; txt += '
'; }// for }// if if(popluarGoods.length > 0){ for(var i = 0; i < popluarGoods.length; i++){ txt2 += '
'; txt2 += '
' + popluarGoods[i].inspectDate + '
'; txt2 += '
'; txt2 += '
' + popluarGoods[i].goodName + '
'; txt2 += '
' + $.number(popluarGoods[i].goodAvgPrice) + '
'; txt2 += '
'; txt2 += '
'; }// for }// if $("#saleArea").html(txt); $("#trendArea").html(txt2); // 할인정보 $('#sale .saleArea').slick({ slidesToShow: 2, slidesToScroll: 1, infinite: true, vertical: true, autoplay:true, autoplaySpeed: 3000, prevArrow: $('#sale .ctrl .prev'), nextArrow: $('#sale .ctrl .next') }); $('#sale .ctrl .stop').on('click', function() { $(this).hide(); $('#sale .saleArea').slick('slickPause'); $('#sale .ctrl .play').show().focus(); }); $('#sale .ctrl .play').on('click', function() { $(this).hide(); $('#sale .saleArea').slick('slickPlay'); $('#sale .ctrl .stop').show().focus(); }); // 상품별 가격동향 $('.trend .slider').slick({ slidesToShow: 1, slidesToScroll: 1, infinite: true, fade: true, autoplay:true, autoplaySpeed:3000, prevArrow: $('.trend .ctrl .prev'), nextArrow: $('.trend .ctrl .next') }); $('.trend .ctrl .stop').on('click', function() { $(this).hide(); $('.trend .slider').slick('slickPause'); $('.trend .ctrl .play').show().focus(); }); $('.trend .ctrl .play').on('click', function() { $(this).hide(); $('.trend .slider').slick('slickPlay'); $('.trend .ctrl .stop').show().focus(); }); } }); });