;$(document).ready(function () { $('#worldMap').constructParallaxMap({marginWidth: 0, marginHeight: 0, colorMap: "images/common/map/mask.png", details: ".detailBox"}); $('#mouseChaserCanvas').kzwMouseChaser({speed: 0.02, frameDuration: 10, initialX: 235, initialY: 107, src: "images/common/map/plane001.png"}); $('#mouseChaserCanvas2').kzwMouseChaser({speed: 0.1, frameDuration: 10, initialX: 235, initialY: 107, src: "images/common/map/plane001.png"}); }); (function($){var PLUGIN_NAME = "constructParallaxMap"; var ImplementationClass = function(target, config) { var settings = $.extend({}, $[PLUGIN_NAME].defaults, config); var myself = this; $(target).data(PLUGIN_NAME, myself); var $clickableMap,$detailMap,$detailMapArea,$currentDetail,color,derailDiv,derailArea,flg = false,waitMapClick = false, DETAILS_DIVS = {}, DETAIL_AREAS = { "#00c4ff": /*世界一周*/ { href: "https://stworld.jp/feature/world/"}, "#c3c3c3": /*国内旅行*/ { href: "https://stworld.jp/earth_info/OK/"}, "#eada83": /*北米*/ { left: -1050, top: -110, width: 1870, height: 1050}, "#43a1cd": /*南米*/ { left: -1300, top: -530, width: 2000, height: 1123}, "#42ff00": /*グアムサイパン*/ { left: -1450, top: -850, width: 3400, height: 1909}, "#a2a4d2": /*オセアニア*/ { left: -1000, top: -870, width: 2600, height: 1460}, "#e8ab6e": /*アジア*/ { left: -520, top: -410, width: 2200, height: 1235}, "#a0c672": /*ヨーロッパ*/ { left: -150, top: -370, width: 3000, height: 1684}, "#ae966c": /*アフリカ*/ { left: 0, top: -420, width: 1870, height: 1050}, "#ff00ff": /*モルディブ*/ { left: -600, top: -1000, width: 3400, height: 1909} }; function _constructor_() { $('html').on('click', function(event){ if(!flg) { $('#detailMapArea').animate( { opacity: 'hide' }, { duration: 500, easing: 'swing' } ); if($currentDetail != null) {$currentDetail.animate( { opacity: 'hide' }, { duration: 200, easing: 'swing' } );} waitMapClick = false; } flg = false; }); var clickableMap = $(target).kzwParallaxMap({ marginWidth: settings.marginWidth, marginHeight: settings.marginHeight }).kzwClickableMap({ colorMap: settings.colorMap, onHit: onMapClick, onChangeArea: onMapMove }); $clickableMap = $(clickableMap).data("kzwParallaxMap"); var detailMap = $('#detailMap').kzwParallaxMap({marginWidth: settings.marginWidth, marginHeight: settings.marginHeight}); $detailMap = $(detailMap).data("kzwParallaxMap"); $detailMapArea = $('#detailMapArea').on('click', function(event){if($(event.target).parent().hasClass('mapCloseBtn')){ return; }flg = true;}); $(settings.details).each(function(){var opts = $(this).data('options');DETAILS_DIVS[opts.color] = {'selector' : "#" + $(this).attr("id")};}); $('.mapLink').on('click', onMapLink); } $.extend( myself, { havingnopoint : "" }); _constructor_(); function onMapMove(event) {} function onMapClick(event) { event.preventDefault(); if(waitMapClick) { flg = true; return; } search(event); if(derailArea != null && derailArea.href) {location.href = derailArea.href;return;} if(derailArea != null ) { waitMapClick = true; $detailMapArea.animate( { opacity: 'show' }, { duration: 500, easing: 'swing' } ); $detailMap.setOffset(derailArea.left, derailArea.top, derailArea.width, derailArea.height, function(){ if($currentDetail != null) {waitMapClick = false;$currentDetail.animate( { opacity: 'show' }, { duration: 500, easing: 'swing' } );} }); } if(derailDiv != null) { if($currentDetail != null && "#" + $currentDetail.attr("id") != derailDiv.selector) {$currentDetail.animate( { opacity: 'hide' }, { duration: 200, easing: 'swing' } );} $currentDetail = $(derailDiv.selector); } if(derailArea == null && derailDiv != null) {$currentDetail.animate( { opacity: 'show' }, { duration: 500, easing: 'swing' } );} flg = true; } function onMapLink(event) {event.hitPixelColor = $(this).attr("href");onMapClick(event);} function search(event) { color = event.hitPixelColor; if(DETAIL_AREAS[color]) {derailArea = DETAIL_AREAS[color];} else {derailArea = null;} if(DETAILS_DIVS[color]) {derailDiv = DETAILS_DIVS[color];} else {derailDiv = null;}} }; $[PLUGIN_NAME] = {defaults : {}}; $.fn[PLUGIN_NAME] = function(config){return this.each(function(i){new ImplementationClass(this, config);});}; })(jQuery);