(function ($, _, util, obj) { /** * お知らせのカテゴリタブ */ var container = document.querySelectorAll('#container>div') var event_li = document.querySelectorAll('#tab>li') var currentindex = 0 for (var i = 0; i < event_li.length; i++) { event_li[i].num = i event_li[0].style.backgroundColor = '#0D2EA1' event_li[0].style.color = '#FFF' event_li[0].classList.add("font-style-1") event_li[0].classList.add("select-tab-border") event_li[i].onclick = function () { container[currentindex].style.display = 'none' var index_other = this.num container[index_other].style.display = 'block' currentindex = index_other for (var i = 0; i < event_li.length; i++) { event_li[i].style.backgroundColor = '' event_li[i].style.color = '' event_li[i].classList.remove("font-style-1") event_li[i].classList.remove("select-tab-border") } this.style.backgroundColor = '#0D2EA1' this.style.color = '#FFF' this.classList.add("font-style-1") this.classList.add("select-tab-border") } } ////////// MODAL START /** * PC版modal */ $("body").data("initFlag", "false"); $.fn.modal = function (option) { if (!option.closeClass) option.closeClass = ".close"; if ($("body").data("initFlag") == "false") { $("#blackLayer").css({ position: "absolute", height: "100px", width: "100%", display: "none", zIndex: 10, }) $("body").data("hashchangeFlag", "false"); $(window).on("hashchange", function (event) { hasChange(event) }); $("#blackLayer").on("click", function (event) { closeEvent(event); return false; }); $("body").data("initFlag", "true"); } $(this).click(function () { $("body").data("hashchangeFlag", "true"); $("body").data("floting-open-top", $(window).scrollTop()); location.hash = $(this).attr("href") $("#blackLayer").css({ top: 0, height: $("body").height() }).show(); $($(this).attr("href")) .css("top", $(window).scrollTop() + option.top) .css("z-index", 11) .addClass("modalInner") .show(); $("a").not(".modalInner a") .css("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); $($(this).attr("href") + " " + option.closeClass).off("click"). on("click", function (event) { // closeEvent(event); if ($("#DisplayLayerFLG").val() == null || $("#DisplayLayerFLG").val().length < 1) { closeEvent(event); hasChange(event); } else { closeEventAutoLayer(event); } return false; }).click(function () { return false; }); return false; }); return this; } let option = { closeClass: ".close", top: 0 } $('a.IdentifyModal').modal(option); function hasChange(event) { if ($("body").data("hashchangeFlag") == "true") {// open modal window $("body").data("hashchangeFlag", "true2"); event.stopImmediatePropagation(); } else if ($("body").data("hashchangeFlag") == "true2") {// close modal window $("body").data("hashchangeFlag", "fase") // $("a").css("-webkit-tap-highlight-color", ""); $("#blackLayer").hide(); $(".modalInner").hide().removeClass(".modalInner"); event.stopImmediatePropagation(); } } function closeEventAutoLayer(event) { $(".modalInner").css("top", $(window).scrollTop()) if (location.href.indexOf('?') == -1) { location.href = location.href.replace(/#.*/g, "") + "?autolayerclose=1"; } else { location.href = location.href.replace(/#.*/g, "") + "&autolayerclose=1"; } } function closeEvent(event) { $(".modalInner").css("top", $(window).scrollTop()) history.back(); $("body").data("hashchangeFlag", "true2"); event.stopPropagation() return false; } $('a[href="#Identify"]').click(function () { $("div[name=Identify]").addClass("model_image"); var buf = $(this)[0].id.split('_'); var id = "#Identify_" + buf[buf.length - 1]; if ($(id).length == 0) { $("#Step2Title").addClass("step2_title"); } else { $("#Step2Title").removeAttr("step2_title").removeClass("step2_title"); $(id).removeAttr("model_image").removeClass("model_image"); var target = $("#scrollbody"); target.animate({ scrollTop: $('#Step2Title').offset().top }, 'slow'); } return false; }); /** * SP版modal */ $('.mod-toggle-section .mod-toggle-section-button').click(function () { $(this).parent().next('.mod-toggle-section .mod-toggle-section-pane').slideToggle(); // $(this).toggleClass('open'); $(this).find('.img-plus').toggleClass('isexpand'); $(this).find('.img-minus').toggleClass('isexpand'); return false; }); /** * SP版modal * 製品検索 */ $("form[name=productsearchform]").on('submit', function () { var url = 'https://support.brother.co.jp/j/b/sp/productlist.aspx?c=jp&lang=ja&content='; var id = "#q" + $(this).attr("id"); var q = $(id).val(); location.href = url + "&q=" + q; return false; }); ////////// MODAL END })(BROTHER.lib.$, BROTHER.lib._, BROTHER.util, BROTHER.obj);