$(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 .graphBox'); $hall_graphBtn = $('.marriage .btnBox>div'); $(document).on('click', '.marriage .graphBtn', function(){ var inx = $(this).closest('div').index(); $(this).closest('li').find('.btnBox>div').removeClass('on').find('.graphBtn').removeAttr('title'); $(this).attr('title', '선택됨').closest('div').addClass('on'); $(this).closest('li').find('.graphBox').removeClass('on'); $(this).closest('li').find('.graphBox').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")); // 반응형 window.addEventListener('resize', function() { chart.resize(); }); // 결혼서비스 예식장 var chart = echarts.init(document.getElementById(item.data("chartname1"))); const resizeObserver = new ResizeObserver(()=>{ chart.resize(); }); resizeObserver.observe(document.getElementById(item.data("chartname1"))); var option = { grid: {left: 5, right: 5, top: 15, bottom: 20, containLabel: true}, tooltip: { trigger: 'item', textStyle: {color: '#000', fontSize: 13} }, xAxis: { type: 'category', data: [ item.data("man5"), item.data("man4"), item.data("man3"), item.data("man2"), item.data("man1"), item.data("man0")], axisLabel: { fontSize: 13, color: '#33446c', lineHeight: 16, interval: 0, rotate: -45, margin: 10, align: 'left', } }, yAxis: { type: 'value', min: 0, splitNumber: 3, }, series: [ { name: item.data("name"), type: 'bar', barWidth: '50%', itemStyle: { borderRadius: [6, 6, 0, 0] }, data:[ { value: item.data("map5"), itemStyle: { color: '#767676'} }, { value: item.data("map4"), itemStyle: { color: '#767676' } }, { value: item.data("map3"), itemStyle: { color: '#767676' } }, { value: item.data("map2"), itemStyle: { color: '#767676' } }, { value: item.data("map1"), itemStyle: { color: '#767676' } }, { value: item.data("map0"), itemStyle: { color: '#2f7fed' } } ] }], legend: {show: false}, }; chart.setOption(option); } function priceChart2(item){ $(".skipGraph2").html(item.data("skip2")); // 반응형 window.addEventListener('resize', function() { chart.resize(); }); // 결혼서비스 예식장 var chart = echarts.init(document.getElementById(item.data("chartname2"))); const resizeObserver = new ResizeObserver(()=>{ chart.resize(); }); resizeObserver.observe(document.getElementById(item.data("chartname2"))); var option = { grid: {left: 5, right: 5, top: 15, bottom: 20, containLabel: true}, tooltip: { trigger: 'item', textStyle: {color: '#000', fontSize: 13} }, xAxis: { type: 'category', data: [ item.data("qan3"), item.data("qan2"), item.data("qan1"), item.data("qan0")], axisLabel: { fontSize: 13, color: '#33446c', lineHeight: 16, interval: 0 } }, yAxis: { type: 'value', min: 0, splitNumber: 3, }, series: [ { name: item.data("name"), type: 'bar', barWidth: '50%', itemStyle: { borderRadius: [6, 6, 0, 0] }, data:[ { value: item.data("qap3"), itemStyle: { color: '#767676'} }, { value: item.data("qap2"), itemStyle: { color: '#767676' } }, { value: item.data("qap1"), itemStyle: { color: '#767676' } }, { value: item.data("qap0"), itemStyle: { color: '#2f7fed' } } ] }], legend: {show: false}, }; chart.setOption(option); } // 주간 가격정보 - 슬라이드 $('.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'); }); // 팝업존 (26.01.05) $('.popupzone .slider').on('init reInit afterChange', function(event, slick, currentSlide, nextSlide){ var i = (currentSlide ? currentSlide : 0) + 1; $('.popupzone .ctrl .current').text(i); $('.popupzone .ctrl .total').text(slick.slideCount); }); $('.popupzone .slider').slick({ slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 4000, prevArrow: $('.popupzone .ctrl .prev'), nextArrow: $('.popupzone .ctrl .next') }); $('.popupzone .ctrl .stop').on('click', function() { $(this).hide(); $('.popupzone .slider').slick('slickPause'); $('.popupzone .ctrl .play').show().focus(); }); $('.popupzone .ctrl .play').on('click', function() { $(this).hide(); $('.popupzone .slider').slick('slickPlay'); $('.popupzone .ctrl .stop').show().focus(); }); //할인정보 클릭 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 += '
'; txt += ''+saleGoods[i].entpName+''; txt += ''+saleGoods[i].goodName+''; txt += ''+$.number(saleGoods[i].goodPrice) +'원'; txt += '
'; txt += ''; txt += '
'; txt += '
'; }// for $(".saleArea").html(txt); }// 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 $("#trendArea").html(txt2); // 할인정보 (26.01.05) $('#sale2 .saleArea').slick({ slidesToShow: 1, slidesToScroll: 1, infinite: true, fade: true, autoplay:true, autoplaySpeed:3000, prevArrow: $('#sale2 .ctrl .prev'), nextArrow: $('#sale2 .ctrl .next') }); $('#sale2 .ctrl .stop').on('click', function() { $(this).hide(); $('#sale2 .saleArea').slick('slickPause'); $('#sale2 .ctrl .play').show().focus(); }); $('#sale2 .ctrl .play').on('click', function() { $(this).hide(); $('#sale2 .saleArea').slick('slickPlay'); $('#sale2 .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(); }); } }); });