var userAgent = window.navigator.userAgent.toLowerCase(); /* =============================================== # PC/SPで処理を切り替え =============================================== */ var _ua = (function(){ return { ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined", ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined", ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined", ltIE9:document.uniqueID && !window.matchMedia, gtIE10:document.uniqueID && document.documentMode >= 10, Trident:document.uniqueID, Gecko:window.sidebar, Presto:window.opera, Blink:window.chrome, Webkit:!window.chrome && typeof document.webkitIsFullScreen != undefined, Touch:typeof document.ontouchstart != "undefined", Mobile:typeof window.orientation != "undefined" } })(); var switch2 = 1; var switch3 = 1; var hoverSw1 = 0; var hoverSw2 = 0; var scrollpos; if(_ua.ltIE9){ $(function(){ var trigger_width = 1007; var myWidthLoad = $(window).width(); if (myWidthLoad < trigger_width) { element2_sp(); } else { element2_pc(); } $(window).resize(function() { var myWidth = $(window).width(); if(myWidthLoad != myWidth) { if (myWidth < trigger_width) { element2_sp(); } else { element2_pc(); } } }); }); } else { $(function(){ var myWidthLoad = $(window).width(); if (window.matchMedia('(max-width:1024px)').matches) { element2_sp(); } else { element2_pc(); } $(window).resize(function() { // windowの幅が切り替わったら実行する var myWidth = $(window).width(); if(myWidthLoad != myWidth) { if (window.matchMedia('(max-width:1024px)').matches) { element2_sp(); } else { element2_pc(); } } }); }); } /* スマホ時に実行させたい処理を書く */ function element2_sp() { switch3 = 1; if(switch2 == 1) { //SPメニュー $("#headerSwitchBtn").click(function(){ $("#hanb__menu").toggleClass("active"); $(".blackfilter").toggleClass("active"); }); //SPメニュー内にあるアンカーリンクをクリックした際にメニューを閉じる $("#hanb__closer,.blackfilter,.close_anker").click(function(){ $("#hanb__menu").removeClass("active"); $(".blackfilter").removeClass("active"); }); //サイドメニューがある時のみ、ヘッダーにサーチアイコンを表示し、絞り込みメニューを呼び出す $("#leftcolumn").removeClass('open'); $("#headerRefineBtn").on("click", function () { if ($(this).hasClass('active')) { $('body').removeClass('fixed').css({'top': 0}); window.scrollTo( 0 , scrollpos ); $(this).removeClass('active'); $("#leftcolumn").removeClass('open'); } else { scrollpos = $(window).scrollTop(); $('body').addClass('fixed').css({'top': -scrollpos}); $(this).addClass('active'); $("#leftcolumn").addClass('open'); } }); $("#refineClose").on("click", function () { $('body').removeClass('fixed').css({'top': 0}); window.scrollTo( 0 , scrollpos ); $("#leftcolumn").removeClass('open'); $("#headerRefineBtn").removeClass('active'); }); //SP用スムーススクロール $('a[href^=#]:not(.non-scroll)').click(function() { var speed = 400; var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var headerHeight = 60; //固定ヘッダーの高さ var position = target.offset().top - headerHeight; //ターゲットの座標からヘッダの高さ分引く $('body,html').animate({scrollTop:position}, speed, 'swing'); return false; }); switch2 = 2; } } /* PC時に実行させたい処理を書く */ function element2_pc() { switch2 = 1; if(switch3 == 1) { //SPメニュー $('#hanb__menu,.blackfilter').removeClass('active'); $("#headerSwitchBtn,#hanb__closer,.blackfilter,.close_anker").off("click"); //サイドメニューがある時のみ、ヘッダーにサーチアイコンを表示し、絞り込みメニューを呼び出す $("#headerRefineBtn").removeClass('active'); $("#headerRefineBtn").off("click"); $("#leftcolumn").removeClass('open'); //PC用スムーススクロール $('a[href^=#]:not(.non-scroll)').click(function() { var speed = 400; var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top; $('body,html').animate({scrollTop:position}, speed, 'swing'); return false; }); switch3 = 2; } } /* =============================================== # スムーススクロール =============================================== */ /* $(function() { $('a[href^=#]:not(.non-scroll)').click(function() { var speed = 400; var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top; $('body,html').animate({scrollTop:position}, speed, 'swing'); return false; }); }); */ /* =============================================== # 各スライダーを管理 =============================================== */ /* トップページ用スライダー */ $(window).on("load",function(){ $('.topSlide').slick({ arrows: true, dots: true, autoplay: true, autoplaySpeed: 4000, responsive: [{ breakpoint: 1025, settings: { autoplaySpeed: 5000, arrows: false } }] }); }); $(function() { $('.top_slide_wrap .dots_prev').on('click',function(){ $('.topSlide').slick('slickPrev'); }); }); $(function() { $('.top_slide_wrap .dots_next').on('click',function(){ $('.topSlide').slick('slickNext'); }); }); /* オススメ製品用スライダー */ $(window).on("load",function(){ if ($('ul.recommendSlide > li').length > 0) { var recoslider = $('ul.recommendSlide').slick({ arrows: true, dots: true, variableWidth: true, slidesToShow: 6, slidesToScroll: 6, adaptiveHeight: true, responsive: [{ breakpoint: 1025, settings: { variableWidth: false, slidesToShow: 1, slidesToScroll: 1 } }] }); } }); /* 一覧・詳細ページ設置用オススメ製品スライダー */ $(window).on("load",function(){ if ($('.recommend_block ul.productsList > li').length > 0) { var recoslider = $('.recommend_block ul.productsList').slick({ arrows: true, dots: true, variableWidth: true, slidesToShow: 4, slidesToScroll: 4, adaptiveHeight: true, responsive: [{ breakpoint: 1025, settings: { variableWidth: false, slidesToShow: 1, slidesToScroll: 1 } }] }); } }); /* ランキング用スライダー */ $(window).on("load",function(){ if ($('ul.rankingSlide > li').length > 0) { var recoslider = $('ul.rankingSlide').slick({ arrows: true, dots: true, variableWidth: true, slidesToShow: 6, slidesToScroll: 6, adaptiveHeight: true, responsive: [{ breakpoint: 1025, settings: { variableWidth: false, slidesToShow: 1, slidesToScroll: 1 } }] }); } }); /* 製品詳細用サムネイル連動スライダー */ $(window).on("load",function(){ var photoSlider = "#photoSlider"; var thumbnailItem = "#thumSlider .thumImg"; var itemCount = $(thumbnailItem).length; $(thumbnailItem).each(function(){ var index = $(thumbnailItem).index(this); $(this).attr("data-index",index); }); $(photoSlider).on('init',function(slick){ var index = $(".slide-item.slick-slide.slick-current").attr("data-slick-index"); $(thumbnailItem+'[data-index="'+index+'"]').addClass("thumbnail-current"); }); $(photoSlider).slick({ fade: true, infinite: false, autoplay: false, arrows: false, dots: false, responsive:[{ breakpoint: 1025, settings:{ infinite: false } }] }); $(thumbnailItem).on('click',function(){ var index = $(this).attr("data-index"); $(photoSlider).slick("slickGoTo",index,false); }); $(photoSlider).on('beforeChange',function(event,slick, currentSlide,nextSlide){ $(thumbnailItem).each(function(){ $(this).removeClass("thumbnail-current"); }); $(thumbnailItem+'[data-index="'+nextSlide+'"]').addClass("thumbnail-current"); }); }); /* 関連商品用スライダー */ $(window).on("load",function(){ if ($('.related_block ul.productsList > li').length > 0) { var recoslider = $('.related_block ul.productsList').slick({ arrows: true, dots: true, variableWidth: true, slidesToShow: 4, slidesToScroll: 4, adaptiveHeight: true, responsive: [{ breakpoint: 1025, settings: { variableWidth: false, slidesToShow: 1, slidesToScroll: 1 } }] }); } }); /* 法人・団体様 OEM作製ページ用SP時限定スライダー */ $(function() { }); /* =============================================== # トップページに配置するブロックを管理 =============================================== */ $(function() { $('.LC_Page_Index #masterMain .news_block,.LC_Page_Index #masterMain .twitter_block').wrapAll('
'); }); /* =========================================================== ▼labelのチェックボックス/ラジオボタンのオン/オフクリックで.is-checkedを付与/除外する =========================================================== */ $(function() { if($(".refines_search_form").length){ // checkbox/radioにチェックがあったらlabelにclassを付ける var refinecheckList = $(".refines_search_form"); refinecheckList.each(function() { var label = $(this).find("label"); // 処理を開始 $(this).find(":checked").closest("label").addClass("is-checked"); // ラベルをクリックし、チェックがついたらis-checkedを付与し、チェックが外れたらis-checkedを除外する label.click(function() { label.filter(".is-checked").removeClass("is-checked"); label.find(":checked").closest(label).addClass("is-checked"); }); }); } }); /* =============================================== # 各アコーディオンを管理 =============================================== */ //PC時サイドメニュー内絞り込み検索 $(function() { $(".side_refines dt").on("click", function () { $(this).next().slideToggle(); if ($(this).hasClass('active')) { $(this).removeClass('active'); } else { $(this).addClass('active'); } }); }); //SP時TOP内絞り込み検索 $(function(){ $('.tglbtn').click(function() { $(this).toggleClass('open'); $(this).next('dd').slideToggle(); }); }); /* =============================================== # タブメニューを管理 =============================================== */ $(function() { $(".tab li").on("click", function() { var ptindex = $('.tab li').index(this); $('.tab li').removeClass('active'); $(this).addClass('active'); $('.detail_switching_cont').removeClass('show').eq(ptindex).addClass('show'); }); }); /* =============================================== # heightLineで高さを揃えて背景色欠けを揃える =============================================== */ $(window).on('load', function(){ $(".top_recommend_block ul.recommendSlide li.slick-slide").heightLine(); }); $(window).on('load', function(){ $(".ranking_block ul.rankingSlide li.slick-slide").heightLine(); }); $(window).on('load', function(){ $(".list_products_recommend_block ul.productsList li.slick-slide").heightLine(); }); $(window).on('load', function(){ $(".related_block ul.productsList li.slick-slide").heightLine(); }); /* =============================================== # スマホ時に高さ100vhのブラウジング対策(iPhoneとAndroidのみ) =============================================== */ if(userAgent.indexOf('msie') != -1 || userAgent.indexOf('trident') != -1){ } else { document.write(""); }; /* 法人・団体様 OEM作製 */ $(window).on("load", function () { $('.oem_sp_slider').slick({ slidesToShow: 1, arrows: false, dots: true, }); });