(function (d) { var config = { kitId: 'fgo7irb', scriptTimeout: 3000, async: true }, h = d.documentElement, t = setTimeout(function () { h.className = h.className.replace(/\bwf-loading\b/g, "") + " wf-inactive"; }, config.scriptTimeout), tk = d.createElement("script"), f = false, s = d.getElementsByTagName("script")[0], a; h.className += " wf-loading"; tk.src = 'https://use.typekit.net/' + config.kitId + '.js'; tk.async = true; tk.onload = tk.onreadystatechange = function () { a = this.readyState; if (f || a && a != "complete" && a != "loaded") return; f = true; clearTimeout(t); try { Typekit.load(config) } catch (e) { } }; s.parentNode.insertBefore(tk, s) })(document); document.addEventListener('DOMContentLoaded', function () { var sl1url = "https://www.mkanyo.jp/rt24-front-screen/"; var sl1hdl = loadXMLDoc(sl1url, document.getElementById("sl-screen")); var slpurl = "https://www.mkanyo.jp/rt24-social-links/"; var slhdl = loadXMLDoc(slpurl, document.getElementById("rtm-sl-ctn")); var sl2url = "https://www.mkanyo.jp/rt24-kataribe-screen/"; var sl2hdl = loadXMLDoc(sl2url, document.getElementById("sl-kataribe"), loadSplide); }); function loadSplide() { var splide = new Splide('.slider', { type: 'fade', perPage: 1, rewind: true, autoplay: true, // arrows: false, // autoWidth: true, heightRatio: 9 / 21, // heightRatio: 0.5625, paginationDirection: 'ttb', speed: 2000 }); splide.on('mounted', function () { var cmpurl = "https://www.mkanyo.jp/rt24-campaigns/"; var cmphdl = loadXMLDoc(cmpurl, document.getElementById("rtm-cmp-ctn")); }).mount(); var splidekataribe = new Splide('.carousel', { type: 'loop', perPage: 4, // height: '9rem', rewind: true, autoplay: true, // padding: 15, // arrows: false, // autoWidth: true, // heightRatio: 9 / 21, // heightRatio: 0.5625, // paginationDirection: 'ttb', speed: 2000 }); splidekataribe.mount(); } function loadXMLDoc(url, container, callback = null) { var xmlhttp = new XMLHttpRequest(); container.classList.add("ajax-loading"); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4 container.classList.remove("ajax-loading"); if (xmlhttp.status == 200) { container.innerHTML = xmlhttp.responseText; container.classList.add("ajax-done"); if (callback != null) { callback(); // window[callback](); } } else if (xmlhttp.status == 400) { container.classList.add("ajax-not-found-error"); console.log('There was an error 400'); } else { container.classList.add("ajax-unknown-error"); console.log('something else other than 200 was returned ' + xmlhttp.status); } } }; xmlhttp.open("GET", url, true); xmlhttp.send(); } function isElementInViewport(el) { var rect = el.getBoundingClientRect(); return ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ); } function findPos(obj) { var curleft = 0, curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); return { x: curleft, y: curtop }; } return undefined; } // jQuery(document).ready(function () { // jQuery('#navigation a, #fixedbar a').on('click', function (e) { // e.preventDefault(); // }); // jQuery(window).on('scroll', function () { // var scrolltop = jQuery(this).scrollTop(); // if (scrolltop >= 215) { // jQuery('#rtm-gnav').addClass("rtm-sticky-top").fadeIn(250); // } else if (scrolltop <= 210) { // jQuery('#rtm-gnav').removeClass("rtm-sticky-top").fadeOut(250); // } // }); // });