$(function() { var SLIDE_timer_speed = 6000; var SLIDE_set_fade_speed = 2000; var SLIDE_swipe_speed = 2000; var SLIDE_ratio = "flexible"; var SLIDE_type = "basic"; var SLIDE_create_i = 0; var SLIDE_past_i = 1; var SLIDE_single_page = "true"; var SLIDE_preload_i = 0; var SLIDE_past_target = ""; var SLIDE_past_entry_title = ""; var SLIDE_past_entry_description = ""; var SLIDE_create_swipe_contents_i = 0; var SLIDE_loop_id = 0; var SLIDE_window_height = $(window).height(); var SLIDE_window_width = $(window).width(); var SLIDE_width = $("#SLIDE").width(); var SLIDE_height = $("#SLIDE").height(); var SLIDE_thumbnail_height = $("#SLIDE > .thumbnail").height(); var SLIDE_pageHolder_width = $("#SLIDE > .thumbnail > .pageHolder").width(); var SLIDE_pageWrap_width = $("#SLIDE > .thumbnail > .pageHolder > .pageWrap").width(); var SLIDE_pageWrap_left = 0; function SLIDE_initialize(){ $(window).on("resize", SLIDE_window_resize); SLIDE_window_resize(); if( SLIDE_maxnum > 1 ){ $("#SLIDE div.arrow_image_right").fadeIn(200); $("#SLIDE div.arrow_image_left").fadeIn(200); SLIDE_single_page = ""; }else{ SLIDE_single_page = "true"; $("#SLIDE div.swipe_contents > .group:first").remove(); } if( SLIDE_type == "basic"){ SLIDE_start_action(); SLIDE_create_img(); $("#SLIDE div.swipe_contents").remove(); $("#SLIDE .swipe_me").remove(); } if( SLIDE_type == "swipe"){ SLIDE_create_swipe_contents(); } } function SLIDE_start_action(){ if( $("html#p_root")[0] ){ setTimeout(function(){ // $("#header").animate({'opacity':1},3000); // setTimeout(function(){ // $("#SLIDE div.arrow_image_right").animate({"right": 0},1000, "easeOutQuint"); // $("#SLIDE div.arrow_image_left").animate({"left": 0},1000, "easeOutQuint"); // },5000); },5000); } // if( $("#slide_wrapper > div")[0] ){ // var set_height = SLIDE_window_height; // $("#slide_blank").stop().animate({ // "height": set_height // }, 1000, "easeOutQuint"); // } // if( $("body.m-600 #slide_wrapper > div")[0] ){ // var set_height = SLIDE_window_height/100*25 + $("#slide_wrapper").height(); // $("#slide_blank").stop().animate({ // "height": set_height // }, 1000, "easeOutQuint"); // }else if( $("#slide_wrapper > div")[0] ){ // var set_height = SLIDE_window_height/100*22 + $("#slide_wrapper").height(); // $("#slide_blank").stop().animate({ // "height": set_height // }, 1000, "easeOutQuint"); // } $("#SLIDE .thumbnail, #SLIDE .frame").animate({"opacity": 1},5000, "easeOutQuint"); //$(this).remove(); } function SLIDE_create_img(){ if( SLIDE_type == "basic" ){ if( SLIDE_past_i != SLIDE_create_i ){ var img_url = SLIDE_array[SLIDE_create_i][0]; var thumb_url = SLIDE_array[SLIDE_create_i][1]; var img_height = SLIDE_array[SLIDE_create_i][2]; var img_width = SLIDE_array[SLIDE_create_i][3]; var caption_jp = SLIDE_array[SLIDE_create_i][4]; var caption_en = SLIDE_array[SLIDE_create_i][5]; var description_jp = SLIDE_array[SLIDE_create_i][6]; var description_en = SLIDE_array[SLIDE_create_i][7]; var link_url = SLIDE_array[SLIDE_create_i][8]; var link_target = SLIDE_array[SLIDE_create_i][9]; var link_to_flag = SLIDE_array[SLIDE_create_i][10]; var entry_title_jp = SLIDE_array[SLIDE_create_i][11]; var entry_title_en = SLIDE_array[SLIDE_create_i][12]; var entry_description_jp = SLIDE_array[SLIDE_create_i][13]; var entry_description_en = SLIDE_array[SLIDE_create_i][14]; SLIDE_switch_thumbs(); SLIDE_past_i = SLIDE_create_i; $("#SLIDE > .frame > .controller > a").remove(); if( link_to_flag != "media" ){ $("#SLIDE > .frame > .controller").append(""); } var entry_description = entry_description_jp + entry_description_en; if( entry_description != SLIDE_past_entry_description ){ $("#SLIDE > .frame > .controller > .text_entry").fadeOut( 500, function () { $("#SLIDE > .frame > .controller > .text_entry > .description > .jp").empty().append(entry_description_jp); $("#SLIDE > .frame > .controller > .text_entry > .description > .en").empty().append(entry_description_en); $(this).fadeIn(1000); } ); SLIDE_past_entry_description = entry_description; } $("#SLIDE > .frame > .controller > .text_media").fadeOut(200, function() { $("#SLIDE > .frame > .controller > .text_media > .title > .jp").empty(); $("#SLIDE > .frame > .controller > .text_media > .title > .jp").append(caption_jp); $("#SLIDE > .frame > .controller > .text_media > .title > .en").empty(); $("#SLIDE > .frame > .controller > .text_media > .title > .en").append(caption_en); $("#SLIDE > .frame > .controller > .text_media > .description > .jp").empty(); $("#SLIDE > .frame > .controller > .text_media > .description > .jp").append(description_jp); $("#SLIDE > .frame > .controller > .text_media > .description > .en").empty(); $("#SLIDE > .frame > .controller > .text_media > .description > .en").append(description_en); $(this).fadeIn(200); } ); var set_img_div = "SLIDE_img_div_" + SLIDE_create_i; $("#SLIDE > .frame > .main").prepend("
"); var target = $("#SLIDE div#" + set_img_div); target.find("img.low").load(function () { target.find("img.low").delay(500).fadeIn(SLIDE_set_fade_speed, "easeOutQuint"); target.find("img.high").load(function () { SLIDE_window_resize(); target.find("img.high").delay(500).fadeIn(SLIDE_set_fade_speed, "easeOutQuint"); }); target.find("img.high").attr("src", img_url); if( SLIDE_past_target != "" ){ SLIDE_past_target.parent().stop().fadeOut( SLIDE_set_fade_speed/2, function () { $(this).remove(); } ); } SLIDE_past_target = target; SLIDE_preload_image(); SLIDE_img_cover_center_action( target, img_height, img_width ); SLIDE_set_timer(); SLIDE_window_resize(); target.addClass("reduce"); }); target.find("img.low").attr("src", thumb_url); } } if( SLIDE_type == "swipe" ){ var img_url = SLIDE_array[SLIDE_create_i][0]; var thumb_url = SLIDE_array[SLIDE_create_i][1]; var img_height = SLIDE_array[SLIDE_create_i][2]; var img_width = SLIDE_array[SLIDE_create_i][3]; var caption_jp = SLIDE_array[SLIDE_create_i][4]; var caption_en = SLIDE_array[SLIDE_create_i][5]; var description_jp = SLIDE_array[SLIDE_create_i][6]; var description_en = SLIDE_array[SLIDE_create_i][7]; var link_url = SLIDE_array[SLIDE_create_i][8]; var link_target = SLIDE_array[SLIDE_create_i][9]; var link_to_flag = SLIDE_array[SLIDE_create_i][10]; var entry_title_jp = SLIDE_array[SLIDE_create_i][11]; var entry_title_en = SLIDE_array[SLIDE_create_i][12]; var entry_description_jp = SLIDE_array[SLIDE_create_i][13]; var entry_description_en = SLIDE_array[SLIDE_create_i][14]; SLIDE_switch_thumbs(); if( SLIDE_single_page == "" ){ SLIDE_loop_cloning(); } SLIDE_past_i = SLIDE_create_i; if( link_to_flag == "media" ){ $("#SLIDE .swipescroll > div.swipe_contents").css({"cursor": "default"}); }else{ $("#SLIDE .swipescroll > div.swipe_contents").css({"cursor": "pointer"}); } $("#SLIDE .swipescroll > div.swipe_contents > .text_media").fadeOut(200, function() { var left = SLIDE_mainframe_width * (SLIDE_create_i + SLIDE_loop_id*SLIDE_maxnum); $("#SLIDE .swipescroll > div.swipe_contents > .text_media").css("left", left); $("#SLIDE .swipescroll > div.swipe_contents > .text_media > div").removeClass().addClass(caption_en); $("#SLIDE .swipescroll > div.swipe_contents > .text_media > div > .message > .title > .jp").empty().append(caption_jp); $("#SLIDE .swipescroll > div.swipe_contents > .text_media > div > .message > .title > .en").empty().append(caption_en); $("#SLIDE .swipescroll > div.swipe_contents > .text_media > div > .message > .description > .jp").empty().append(description_jp); $("#SLIDE .swipescroll > div.swipe_contents > .text_media > div > .message > .description > .en").empty().append(description_en); $(this).fadeIn(1000); } ); var entry_title = entry_title_jp + entry_title_en; if( entry_title != SLIDE_past_entry_title ){ $("#SLIDE .swipescroll > .text_entry").fadeOut( 500, function () { $("#SLIDE > .frame > .controller > .text_entry > .title > .jp").empty().append(entry_title_jp); $("#SLIDE > .frame > .controller > .text_entry > .title > .en").empty().append(entry_title_en); $(this).fadeIn(1000); } ); } SLIDE_past_entry_title = entry_title; var target = $("#SLIDE div#SLIDE_img_div_" + SLIDE_create_i); target.find("img.high").load(function () { SLIDE_window_resize(); target.find("img.high").fadeIn(SLIDE_set_fade_speed, "easeOutQuint"); }); target.find("img.high").attr("src", img_url); SLIDE_past_target = target; SLIDE_img_cover_center_action( target, img_height, img_width ); SLIDE_set_timer(); } } function SLIDE_preload_image(){ $("#SLIDE > .frame > .main > img").remove(); SLIDE_preload_i = SLIDE_create_i+1; if( SLIDE_preload_i >= SLIDE_maxnum ){ SLIDE_preload_i = 0; } var next_img_url = SLIDE_array[SLIDE_preload_i][0]; $("#SLIDE > .frame > .main").append(""); var next_target = $("#SLIDE img#pre_" + SLIDE_preload_i ); next_target.attr("src", next_img_url); } function SLIDE_img_fit_action( target, img_height, img_width ){ target.addClass("fit"); SLIDE_window_resize(); } function SLIDE_img_cover_center_action( target, img_height, img_width ){ target.addClass("cover_center"); SLIDE_window_resize(); } function SLIDE_img_cover_pan_action( target, img_height, img_width ){ var target_width = $("#SLIDE > .frame > .main").width(); var target_height = parseInt(img_height*(target_width/img_width)); if( target_height <= SLIDE_mainframe_height ){ target.addClass("cover_pan_expand"); target_height = SLIDE_mainframe_height*1.25; target.css({ "top": SLIDE_mainframe_height-target_height, "height": target_height }); target.animate({ "top": "0px" }, SLIDE_timer_speed + 2000, "swing"); SLIDE_window_resize(); }else{ target.addClass("cover_pan"); SLIDE_window_resize(); target.css({ "top": SLIDE_mainframe_height-target_height, "width": "100%" }); target.animate({ "top": "0px" }, SLIDE_timer_speed + 2000, "swing"); } } function SLIDE_window_resize(option) { SLIDE_window_height = $(window).height(); SLIDE_window_width = $(window).width(); if( SLIDE_ratio == "flexible" ){ SLIDE_width = $("#SLIDE").width(); SLIDE_height = $("#SLIDE").height(); }else{ SLIDE_width = $("#SLIDE").width(); SLIDE_height = Math.round(SLIDE_width*0/0); $("#SLIDE").css({"height": SLIDE_height}); } SLIDE_mainframe_width = $("#SLIDE > .frame > .main").width(); SLIDE_mainframe_height = $("#SLIDE > .frame > .main").height(); SLIDE_thumbnail_height = $("#SLIDE > .thumbnail").height(); SLIDE_pageHolder_width = $("#SLIDE > .thumbnail > .pageHolder").width(); SLIDE_pageWrap_width = $("#SLIDE > .thumbnail > .pageHolder > .pageWrap").width(); if( SLIDE_type == "swipe"){ $("#SLIDE .swipescroll > div.swipe_contents > .group > .swipe_ul > .swipe_li").css("width", SLIDE_mainframe_width); $("#SLIDE .swipescroll > div.swipe_contents > .text_media").css("width", SLIDE_mainframe_width); $("#SLIDE .swipescroll > div.swipe_contents > .group").each(function(){ var swipe_li_num = $(this).find('.swipe_li').length; var group_width = SLIDE_mainframe_width*swipe_li_num; $(this).css({"width":group_width}); }); var left = SLIDE_mainframe_width * (SLIDE_create_i + SLIDE_loop_id*SLIDE_maxnum); if( option == "no_animate" ){ $("#SLIDE .swipescroll > div.swipe_contents").stop().css({"left": -left}); }else{ $("#SLIDE .swipescroll > div.swipe_contents").stop().animate({"left": -left}, SLIDE_swipe_speed, "easeInOutCubic"); } var width = parseInt($("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + SLIDE_loop_id + "]").width()); $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id) + "]").css("left", width*(SLIDE_loop_id)); $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id - 1) + "]").css("left", width*(SLIDE_loop_id - 1)); $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id + 1) + "]").css("left", width*(SLIDE_loop_id + 1)); if( SLIDE_single_page == "" && isTouch() ){ SLIDE_swipe_action(); } } if( $("#SLIDE div.image_wrapper")[0] ){ if( SLIDE_type == "swipe"){ $("#SLIDE div.image_wrapper").each(function(){ if( "cover_center" == "cover_pan" ){ var img_height = $(this).attr("data-height"); var img_width = $(this).attr("data-width"); var target_width = $("#SLIDE > .frame > .main").width(); var target_height = parseInt(img_height*(target_width/img_width)); $(this).removeClass("cover_pan"); $(this).removeClass("cover_center"); if( target_height <= SLIDE_mainframe_height ){ $(this).addClass("cover_center"); }else{ $(this).addClass("cover_pan"); } }else{ $(this).addClass("cover_center"); } }); } $("#SLIDE div.image_wrapper.fit").each(function(){ var img_height = $(this).attr("data-height"); var img_width = $(this).attr("data-width"); if( Math.round(img_width / SLIDE_mainframe_width * 100) <= Math.round(img_height / SLIDE_mainframe_height * 100) ){ var target_height = SLIDE_mainframe_height; var target_width = img_width*Math.round(SLIDE_mainframe_height/img_height*100)/100; var target_top = 0; var target_left = (SLIDE_mainframe_width - target_width)/2; }else{ var target_width = SLIDE_mainframe_width; var target_height = img_height*Math.round(SLIDE_mainframe_width/img_width*100)/100; var target_top = (SLIDE_mainframe_height - target_height)/2; var target_left = 0; } $(this).css({ "height": target_height, "width": target_width, "top": target_top, "left": target_left }); }); $("#SLIDE div.image_wrapper.cover_center").each(function(){ var img_height = $(this).attr("data-height"); var img_width = $(this).attr("data-width"); if( Math.round(img_width / SLIDE_mainframe_width * 100) >= Math.round(img_height / SLIDE_mainframe_height * 100) ){ var target_height = SLIDE_mainframe_height; var target_width = img_width*Math.round(SLIDE_mainframe_height/img_height*100)/100; var target_top = 0; var target_left = (SLIDE_mainframe_width - target_width)/2; }else{ var target_width = SLIDE_mainframe_width; var target_height = img_height*Math.round(SLIDE_mainframe_width/img_width*100)/100; var target_top = (SLIDE_mainframe_height - target_height)/2; var target_left = 0; } $(this).css({ "height": target_height, "width": target_width, "top": target_top, "left": target_left }); }); $("#SLIDE div.image_wrapper.cover_pan").each(function(){ var img_height = $(this).attr("data-height"); var img_width = $(this).attr("data-width"); var target_width = SLIDE_mainframe_width; var target_height = img_height*Math.round(SLIDE_mainframe_width/img_width*100)/100; $(this).css({ "height": target_height, "width": target_width, "margin-left": 0 }); }); $("#SLIDE div.image_wrapper.cover_pan_expand").each(function(){ var img_height = $(this).attr("data-height"); var img_width = $(this).attr("data-width"); var target_height = SLIDE_mainframe_height*1.25; var target_width = img_width*Math.round(SLIDE_mainframe_height/img_height*100)/100*1.25; $(this).css({ "height": target_height, "width": target_width, "margin-left": (SLIDE_mainframe_width-target_width)/2 }); }); } SLIDE_arrow_show_hide(); } function SLIDE_set_timer(){ if( typeof SLIDE_Repeater != "undefined" ){ clearTimeout( SLIDE_Repeater ); } if( SLIDE_repeat_flag == "true" ){ SLIDE_Repeater = setTimeout( function(){ SLIDE_slide_play(); } , SLIDE_timer_speed); } } function SLIDE_slide_play(){ SLIDE_create_i ++; if( SLIDE_create_i == SLIDE_maxnum){ SLIDE_create_i = 0; SLIDE_loop_id ++; SLIDE_create_img(); }else{ SLIDE_create_img(); } } $("#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a").click(function(){ SLIDE_create_i = parseInt($(this).attr("id")); SLIDE_create_img(); SLIDE_set_timer(); return false; }) function SLIDE_switch_thumbs(){ $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_past_i ).removeClass("active"); $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_past_i ).addClass("over"); $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_past_i ).css("opacity", 0.5); $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_past_i ).css("cursor", "pointer"); $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_create_i ).removeClass("over"); $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_create_i ).addClass("active"); $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_create_i ).css("opacity", 1); $( "#SLIDE > .thumbnail > .pageHolder > .pageWrap > ul > li > a#"+SLIDE_create_i ).css("cursor", "default"); } function SLIDE_arrow_show_hide() { if(SLIDE_pageHolder_width >= SLIDE_pageWrap_width){ $("#SLIDE .arrow_page_left").fadeOut(200); $("#SLIDE .arrow_page_right").fadeOut(200); }else if(SLIDE_pageWrap_left == 0){ $("#SLIDE .arrow_page_left").fadeOut(200); $("#SLIDE .arrow_page_right").fadeIn(200); }else if(-SLIDE_pageWrap_left + SLIDE_pageHolder_width >= SLIDE_pageWrap_width){ $("#SLIDE .arrow_page_left").fadeIn(200); $("#SLIDE .arrow_page_right").fadeOut(200); }else{ $("#SLIDE .arrow_page_left").fadeIn(200); $("#SLIDE .arrow_page_right").fadeIn(200); } } $("#SLIDE div.arrow_page_right").click(function(){ if(-(SLIDE_pageWrap_left-SLIDE_pageHolder_width) + SLIDE_pageHolder_width >= SLIDE_pageWrap_width){ SLIDE_pageWrap_left += SLIDE_pageHolder_width-(SLIDE_pageWrap_width+SLIDE_pageWrap_left); }else{ SLIDE_pageWrap_left -= SLIDE_pageHolder_width-60; } $("#SLIDE .pageHolder .pageWrap").stop().animate({ marginLeft : SLIDE_pageWrap_left+"px" },200, "easeOutQuint"); SLIDE_arrow_show_hide(); }) $("#SLIDE div.arrow_page_left").click(function(){ if(SLIDE_pageWrap_left+SLIDE_pageHolder_width-60 >= 0){ SLIDE_pageWrap_left = 0; }else{ SLIDE_pageWrap_left += SLIDE_pageHolder_width-60; } $("#SLIDE .pageHolder .pageWrap").stop().animate({ marginLeft : SLIDE_pageWrap_left+"px" },200, "easeOutQuint") SLIDE_arrow_show_hide(); }) $("#SLIDE div.arrow_image_right").click(function(){ SLIDE_create_i ++; if( SLIDE_create_i == SLIDE_maxnum){ SLIDE_loop_id ++; SLIDE_create_i = 0; } SLIDE_create_img(); SLIDE_set_timer(); }) $("#SLIDE div.arrow_image_left").click(function(){ if( SLIDE_create_i == 0){ SLIDE_loop_id --; SLIDE_create_i = SLIDE_maxnum; } SLIDE_create_i --; SLIDE_create_img(); SLIDE_set_timer(); }) function SLIDE_fade_show(){ if( typeof SLIDE_fade_timer != "undefined" ){ clearTimeout( SLIDE_fade_timer ); } $("#SLIDE .fade:not(:animated)").stop().animate({opacity: 1},400); SLIDE_fade_timer = setInterval(SLIDE_fade_hide, 2000); } function SLIDE_fade_hide(){ $("#SLIDE .fade:not(:animated)").animate({opacity: 0.6}, 400); clearInterval( SLIDE_fade_timer ); } $("#SLIDE > .frame").mousemove(function(e){ SLIDE_fade_show(); }); function isTouch(){ return (document.ontouchstart !== undefined); } function SLIDE_swipe_action(){ var setMainId = $('#SLIDE .swipescroll'); var setMainUl = setMainId.children('div.swipe_contents'); var listWidth = parseInt(setMainUl.find('.swipe_li').css('width')); var listCount = setMainUl.find('.swipe_li').length; var leftMax = -((listWidth)*((listCount)-1)); var isTouch = ('ontouchstart' in window); setMainUl.off(); setMainUl.on( {'touchstart': function(e){ if( "on" == "on"){ SLIDE_repeat_flag = "false"; SLIDE_set_timer(); } var setMainUlNot = setMainId.children('div.swipe_contents'); setMainUlNot.stop(); setMainUlNot.each(function(){ this.leftBegin = parseInt($(this).css('left')); this.touchX = event.changedTouches[0].pageX; this.touchY = event.changedTouches[0].pageY; this.slideX = $(this).position().left; }); },'touchmove': function(e){ var moveX = this.touchX - event.changedTouches[0].pageX; var moveY = this.touchY - event.changedTouches[0].pageY; var moveRate = moveX / moveY; if(moveRate > Math.tan(15 * Math.PI/180)) { e.preventDefault(); } this.slideX = this.slideX - (this.touchX - event.changedTouches[0].pageX ); $(this).css({left:this.slideX}); this.touchX = event.changedTouches[0].pageX; },'touchend': function(e){ var abs = Math.abs( this.leftBegin - this.slideX ); if( abs < 50 ){ SLIDE_window_resize(); } else if(this.leftBegin > this.slideX){ SLIDE_create_i ++; if( SLIDE_create_i >= SLIDE_maxnum ){ SLIDE_loop_id ++; SLIDE_create_i = 0; } setMainUl.find('.swipe_' + SLIDE_create_i).addClass('active'); SLIDE_create_img(); } else if(this.leftBegin < this.slideX) { SLIDE_create_i --; if( SLIDE_create_i < 0 ){ SLIDE_loop_id --; SLIDE_create_i = SLIDE_maxnum -1; } setMainUl.find('.swipe_' + SLIDE_create_i).addClass('active'); SLIDE_create_img(); } else if(this.leftBegin === 0) { } else if(this.leftBegin <= leftMax) { } SLIDE_loop_cloning(); if( "on" == "on"){ SLIDE_repeat_flag = "true"; SLIDE_set_timer(); } } }); $("#SLIDE div.swipe_contents > *").off(); $("#SLIDE div.swipe_contents > *").on({ 'touchstart mousedown': function() { this.isTouch = true; }, 'touchmove mousemove': function() { this.isTouch = false; }, 'touchend mouseup': function() { if(this.isTouch == true){ if( $(this).parent().find('.swipe_' + SLIDE_create_i).children("a")[0] ){ var url = $(this).parent().find('.swipe_' + SLIDE_create_i).children("a").attr("href"); var target = $(this).parent().find('.swipe_' + SLIDE_create_i).children("a").attr("target"); var link_to_flag = $(this).parent().find('.swipe_' + SLIDE_create_i).children("a").attr("data-link-to-flag"); if( link_to_flag != "media" ){ if( target == "" ){ window.location.href = url; }else{ window.open(url); } } } } } }); } function SLIDE_swipe_me(span){ var target_wrapper = $("#SLIDE .swipe_me"); var target = $("#SLIDE .swipe_me > div"); target_wrapper.animate({ "opacity": 1 }, 500, function(){ target.animate({ "margin-left": -span }, 500, "swing", function(){ target_wrapper.animate({ "opacity": 0 }, 500, "swing", function(){ target.css({"margin-left": ""}); target_wrapper.animate({ "opacity": 1 }, 200, function(){ target.animate({ "margin-left": -span }, 500, "swing", function(){ target_wrapper.animate({ "opacity": 0 }, 500, function(){ target_wrapper.remove(); }); }); }); }); }); }); } function SLIDE_create_swipe_contents(){ if( SLIDE_create_swipe_contents_i < SLIDE_maxnum ){ var img_url = SLIDE_array[SLIDE_create_swipe_contents_i][0]; var thumb_url = SLIDE_array[SLIDE_create_swipe_contents_i][1]; var img_height = SLIDE_array[SLIDE_create_swipe_contents_i][2]; var img_width = SLIDE_array[SLIDE_create_swipe_contents_i][3]; var caption_jp = SLIDE_array[SLIDE_create_swipe_contents_i][4]; var caption_en = SLIDE_array[SLIDE_create_swipe_contents_i][5]; var description_jp = SLIDE_array[SLIDE_create_swipe_contents_i][6]; var description_en = SLIDE_array[SLIDE_create_swipe_contents_i][7]; var link_url = SLIDE_array[SLIDE_create_swipe_contents_i][8]; var link_target = SLIDE_array[SLIDE_create_swipe_contents_i][9]; var link_to_flag = SLIDE_array[SLIDE_create_swipe_contents_i][10]; var entry_title_jp = SLIDE_array[SLIDE_create_swipe_contents_i][11]; var entry_title_en = SLIDE_array[SLIDE_create_swipe_contents_i][12]; var entry_description_jp = SLIDE_array[SLIDE_create_swipe_contents_i][13]; var entry_description_en = SLIDE_array[SLIDE_create_swipe_contents_i][14]; var target_wrapper = $("#SLIDE .swipe_" + SLIDE_create_swipe_contents_i); var style = ""; if( link_url != "" ){ target_wrapper.append(""); } var set_img_div = "SLIDE_img_div_" + SLIDE_create_swipe_contents_i; target_wrapper.append("
"); var target = target_wrapper.find("div#" + set_img_div); target.find("img.low").load(function () { target.find("img.low").fadeIn(SLIDE_set_fade_speed, "easeOutQuint"); target.addClass("cover_center"); setTimeout(function(){ SLIDE_create_swipe_contents_i ++; SLIDE_create_swipe_contents(); },10); }); target.find("img.low").attr("src", thumb_url); } if( SLIDE_create_swipe_contents_i == SLIDE_create_i ){ SLIDE_window_resize("no_animate"); SLIDE_create_img(); SLIDE_start_action(); if( isTouch() ){ setTimeout(function(){ SLIDE_swipe_me(120); },800); }else{ $("#SLIDE .swipe_me").remove(); } } if( SLIDE_create_swipe_contents_i == SLIDE_maxnum ){ SLIDE_window_resize(); } } function SLIDE_loop_cloning(){ if( SLIDE_create_i == 0 ){ var clone_target = $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + SLIDE_loop_id + "]"); if( ! $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id - 1) + "]")[0] ){ var target = clone_target.after(clone_target.clone()); target.attr("data-loop-id",SLIDE_loop_id - 1); target.css({"left": parseInt(clone_target.css("left")) - clone_target.width()}); } if( $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id + 1) + "]")[0] ){ $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id + 1) + "]").remove(); } }else if( SLIDE_create_i == SLIDE_maxnum-1 ){ var clone_target = $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + SLIDE_loop_id + "]"); if( ! $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id + 1) + "]")[0] ){ var target = clone_target.before(clone_target.clone()); target.attr("data-loop-id",SLIDE_loop_id + 1); target.css({"left": parseInt(clone_target.css("left")) + clone_target.width()}); } if( $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id - 1) + "]")[0] ){ $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id - 1) + "]").remove(); } }else{ if( SLIDE_create_i > 1 && SLIDE_create_i < SLIDE_maxnum-2 ){ if( $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id - 1) + "]")[0] ){ $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id - 1) + "]").remove(); } if( $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id + 1) + "]")[0] ){ $("#SLIDE .swipescroll > div.swipe_contents > .group[data-loop-id = " + (SLIDE_loop_id + 1) + "]").remove(); } } } } $(document).on("mouseover", "#SLIDE .pageHolder img.over", function(){ $(this).stop().animate({ opacity : 1 },50) }); $(document).on("mouseout", "#SLIDE .pageHolder img.over", function(){ $(this).stop().animate({ opacity : 0.5 },200) }); var SLIDE_array = new Array(); var count_i = 0; $("#SLIDE .thumbnail > .pageHolder > .pageWrap > ul").each(function(){ var i = 0; var entry_title_jp = ""; var entry_title_en = ""; var entry_description_jp = ""; var entry_description_en = ""; $(this).find("li").each(function(){ if(i==0){ entry_title_jp = $(this).children("h2").children(".entry_title_jp").html(); entry_title_en = $(this).children("h2").children(".entry_title_en").html(); entry_description_jp = $(this).children(".entry_description_jp").html(); entry_description_en = $(this).children(".entry_description_en").html(); }else{ var target = $(this).children("a"); var img_url = target.children(".img").attr("data-img-url"); var thumb_url = target.children(".img").attr("data-thumb-url"); var img_height = target.children(".img").attr("data-height"); var img_width = target.children(".img").attr("data-width"); var caption_jp = target.children(".caption_jp").html(); var caption_en = target.children(".caption_en").html(); var description_jp = target.children(".description_jp").html(); var description_en = target.children(".description_en").html(); var link_url = target.attr("href"); var link_target = target.attr("target"); var link_to_flag = target.attr("data-link-to-flag"); SLIDE_array.push( [img_url, thumb_url, img_height, img_width, caption_jp, caption_en, description_jp, description_en, link_url, link_target, link_to_flag, entry_title_jp, entry_title_en, entry_description_jp, entry_description_en] ); count_i++; } i++; }); }); SLIDE_maxnum = count_i; if( "on" == "on" && SLIDE_maxnum > 1 ){ var SLIDE_repeat_flag = "true"; }else{ var SLIDE_repeat_flag = "false"; } function SLIDE_preload(){ var img = [], img_arr = $("#SLIDE .thumbnail img"), // ローディング対象の画像を指定 img_arr_lngth = img_arr.size(); img_arr.each(function(indx){ img[indx] = new Image(); img[indx].onload = function(){ img_arr_lngth = img_arr_lngth - 1; if( 0 >= img_arr_lngth ){ SLIDE_initialize(); } }; img[indx].src = $(this).attr('src'); }); } $(window).on('load', function() { if( $("#SLIDE")[0] ){ $("#SLIDE").addClass("flexible"); $("#SLIDE").addClass("cover_center"); setTimeout(function(){ if( SLIDE_ratio != "flexible" ){ SLIDE_width = $("#SLIDE").width(); SLIDE_height = Math.round(SLIDE_width*0/0); $("#SLIDE").css({"height": SLIDE_height}); } SLIDE_preload(); },500); } }); function product_loadmore_loadmore_index( id, index_count_i, index_count_limit, href ){ $("#container > article#gallery_ > div.index > ul > li.load_more > a").stop().animate({"opacity": 0}, 400,"easeOutQuad",function(){ $.ajax({ url: "https://cagra.net/ajax_product_load.php", data: "id=" + id + "&index_count_i=" + index_count_i + "&index_count_limit=" + index_count_limit + "", success: function(data, dataType){ $("#container > article#gallery_ > div.index > ul > li.load_more").remove(); $("#container > article#gallery_ > div.index > ul").append( data ); img_load_fade(); }, complete: function(XMLHttpRequest, textStatus){ }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); }); } $(document).on("click", "#container > article#gallery_ > div.index > ul > li.load_more > a", function(){ var id = $(this).attr("data-id"); var index_count_i = $(this).attr("data-index_count_i"); var index_count_limit = $(this).attr("data-index_count_limit"); var href = $(this).attr("href").replace( "https://cagra.net/", "" ); product_loadmore_loadmore_index( id, index_count_i, index_count_limit, href ); return false; }); function htmlEncode(value){ return $('
').text(value).html(); } function htmlDecode(value){ return $('
').html(value).text(); } function img_load_fade(){ $("img.preload:not('.loaded')").imagesLoaded(function(){ $(this).addClass("loaded"); }); } });