').prepend(ajax_data));
// $("#navi").empty();
// $("#navi").prepend(get_navi_elm);
$("#container > div#base > article").addClass("ajax");
setTimeout(
function(){
$("#container > div#base > article.leave").remove();
load_iframe();
// FB.XFBML.parse();
PJAX_loading_remove();
var scrollto_val = 0;
window_resize();
if( scroll != "" ){
setTimeout(
function(){
window_resize();
scrollto_val = $("#" + selectorEscape(scroll)).position().top + 10;
scrollto(scrollto_val);
}
, 1000);
}else{
scrollto(scrollto_val);
}
hashchange_action( hash );
}
, 10);
if( data.directory == "root" ){
slide_start( $("body #container > div#base > article#root > article#top > div.inner > div.slide") );
}
img_load();
scroll_action_flag = true;
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
function PJAX_ajaxload_load_more( href, data, option, target ) {
var scroll = data.scroll;
if( typeof ajax_request != "undefined" ){
ajax_request.abort();
}
ajax_request = $.ajax({
url: href,
dataType: "html",
success:
function(data, dataType){
target.children("li.load_more").remove();
var get_elm = $('div.index > ul > *', $('
').prepend(data));
target.append(get_elm);
img_load();
window_resize();
PJAX_loading_remove();
scroll_action_flag = true;
var target_index = target.closest(".index");
// thm_random_fade_start( target_index );
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
function class_active(directory){
var slsh_to_ub = directory.replace( /\//g, "_" );
$("#navi nav li").removeClass("active");
$("#navi nav li").removeClass("p_active");
if( $(".class_" + slsh_to_ub + " a")[0] ){
var target_nav = $(".class_" + slsh_to_ub + " a");
target_nav.parent("li").removeClass("over");
target_nav.parent("li").addClass("active");
target_nav.closest("li.parent").removeClass("over");
target_nav.closest("li.parent").addClass("p_active");
}
}
function scrollto(val){
scroll_action_flag = false;
$('#container > div#base').stop().animate({
scrollTop: val
}, 1000, "easeOutQuint",function(){
scroll_action_flag = true;
});
}
function PJAX_pushState( href, title ) {
if ( window.history.pushState ) {
window.history.pushState( title, null, href );
} else {
}
}
window.onpopstate = function(event){
if (event.state) {
} else {
}
var href = location.href;
if ( window.history.pushState ) {
PJAX_pjax( href, "by_onpop", "" );
} else {
var href = "https://k-renovation.com/#!/" + href.replace( /^.\//, '' );
window.location = href;
}
}
$(document).on("click", "a.pjax", function(){
var href = $(this).attr("href");
if ( window.history.pushState ) {
PJAX_pjax( href, "", "" );
} else {
var href = href.replace( "https://k-renovation.com/", "" );
var href = "https://k-renovation.com/#!/" + href.replace( /^.\//, '' );
var past_href = location.href;
window.location = href;
}
return false;
});
$(document).on("click", "div.index > ul > li.load_more > a.pjax_load_more", function(){
var href = $(this).attr("href");
var target = $(this).closest("ul");
if ( window.history.pushState ) {
var parent = $(this).parent();
parent.addClass("loading");
parent.append('
loading
');
PJAX_pjax( href, "by_load_more", target );
}
return false;
});
window.paging_init = function( page ){
var page_wrapper = $("body.about div.body.page_wrapper");
if( page_wrapper[0] ){
if( ! page_wrapper.hasClass("active") ){
console.log('paging_init');
var page_num = page_wrapper.children("div.wrapper.page[data-page]").length;
if( page_num > 1 ){
page_wrapper.addClass("normal");
page_wrapper.next('div.paging').append('
')
var ol_elm = page_wrapper.next('div.paging').find("ol");
for (var i = 0; i < page_num; i++) {
console.log(i+"/"+page_num);
var set_page_num = i+1;
ol_elm.append('
'+set_page_num+'');
}
}else{
page_wrapper.addClass("single");
}
page_wrapper.addClass("active");
}
if( page ){
page_change_to(page,page_wrapper);
}else{
page_change_to(1,page_wrapper);
}
}
}
function page_change_to(page,page_wrapper){
console.log('page:'+page);
page_wrapper.attr("data-page_now",page);
page_wrapper.find("div.wrapper.page[data-page]").removeClass("active");
page_wrapper.find("div.wrapper.page[data-page]").eq(page-1).addClass("active");
var paging_wrapper = page_wrapper.next(".paging");
paging_wrapper.find("li").removeClass("active");
paging_wrapper.find("li").eq(page-1).addClass("active");
}
window.hashchange_action = function( hash ){
var hash_arr = hash.split("#p/");
var hash = hash_arr[1];
if( $("body.about div.body.page_wrapper")[0] ){
if( hash != "" ){
console.log(hash);
paging_init( hash );
}
}
var href = location.href;
var ga_title = document.title;
var ga_id = href.replace( "https://k-renovation.com/", "" ).replace( "?mode=preview", "" );
}
$(window).hashchange( function(){
var hash = location.hash;
if( hash.indexOf( "#!/" ) != -1 ){
var href = hash.replace( /^#!\//, '' );
if( href == "" ){
var href = "https://k-renovation.com/";
}
PJAX_pjax( href, "", "" );
}else if(hash.indexOf( "#p/" ) != -1 ){
hashchange_action( hash );
}else{
if( $("body.about div.body.page_wrapper.normal.active")[0] ){
hashchange_action( "#p/1" );
}
}
})
if( location.hash != "" ){
var hash = location.hash;
if( hash.indexOf( "#!/" ) != -1 ){
var href = hash.replace( /^#!\//, '' );
if( href == "" ){
var href = "https://k-renovation.com/";
}
PJAX_pjax( href, "", "" );
}else if(hash.indexOf( "#p/" ) != -1 ){
hashchange_action( hash );
}
}
$(window).bind('load', function() {
var hash = location.hash;
if( hash.indexOf( "#!/" ) != -1 ){
var href = hash.replace( /^#!\//, '' );
if ( window.history.pushState ) {
window.location = href;
}else{
PJAX_pjax( href, "", "" );
}
}
});
function scroll_trigger() {
if( $(".scroll_trigger:not(.action)")[0] ){
$(".scroll_trigger:not(.action)").each(function(i){
var target = $(this);
var position = target.position().top;
var move_y = +(position - scroll_val);
var in_position = position + window_height/3;
var window_bottom_position = $("body #container > div#base").scrollTop() + $(window).height();
if(in_position < window_bottom_position){
target.addClass('action');
if( target.find(".index")[0] ){
var target_index = target.find(".index");
// setTimeout(function(){
// // thm_random_fade_start( target_index );
// },200);
}
if( target.find(".textillate_wrapper")[0] ){
var target_textillate = target.find(".textillate_wrapper");
textillate( target_textillate, 600 );
}
}
});
}
if( $("#float_pickup")[0] ){
var fp_class_get = "start";
$("body #container > div#base > article#root > article.ground.scroll_trigger").each(function(i){
var target = $(this);
var position = target.position().top + window_height/2;
var elm_top_position = position;
var elm_bottom_position = position + target.outerHeight(true);
var window_bottom_position = $("body #container > div#base").scrollTop() + window_height;
if(window_bottom_position > elm_top_position && window_bottom_position < elm_bottom_position){
var fp_class = $("#float_pickup").attr("data-scroll");
var fp_class_get = target.attr("id");
if( fp_class != fp_class_get ){
$("#float_pickup").attr("data-scroll",fp_class_get);
}
}
});
}
}
function textillate(wrapper,speed) {
if( wrapper.find("span")[0] ){
wrapper.addClass("textillate");
wrapper.find("span").each(function(i){
// $(this).delay(speed*i).queue(function() {
// $(this).addClass("show");
// });
$(this).delay(speed*i).queue(function() {
$(this).textillate({ in: {
effect: 'fadeIn',
delay: 50
} }).dequeue();
});
});
}
}
function thm_random_fade_start( target_index ){
var target_thms = target_index.find("ul > li.thm:not(.show)");
thm_random_fade( target_thms, 200 );
}
function thm_random_fade( targets, delay ){
var target_num = targets.length;
var random_i = Math.floor(Math.random()*target_num);
$(targets[random_i]).addClass("show");
targets.splice(random_i,1);
if (target_num > 0) {
setTimeout(function(){
thm_random_fade( targets, delay );
},delay);
} else {
return false;
}
}
function scroll_off(){
var scroll_event = 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll';
$(document).on(scroll_event,function(e){e.preventDefault();});
$(document).on('touchmove.noScroll', function(e) {e.preventDefault();});
}
function scroll_on(){
var scroll_event = 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll';
$(document).off(scroll_event);
$(document).off('.noScroll');
}
if( id == "" ){
// scroll_off();
}else{
// scroll_on();
}
var document_height = $(document).height();
var content_height = get_total_height($("#container > div#base > *"));
var entry_height = get_total_height($("#entry > div.inner > *"));
if( $("html.touch_device")[0] ){
if( window.innerHeight > window.innerWidth ){
var window_height = $(window).height();
}else{
var window_height = $(window).height();
}
}else{
var window_height = window.innerHeight ? window.innerHeight: $(window).height();
}
var window_width = $(window).width();
var window_ratio = window_height / window_width;
var scroll_val = $("body #container > div#base").scrollTop();
var scroll_action_flag = true;
if( $("body.modal")[0] ){
scroll_action_flag = false;
}
if( $("body.entry")[0] ){
scroll_action_flag = false;
}
function base_scroll() {
scroll_trigger();
scroll_val = $("body #container > div#base").scrollTop();
// console.log(scroll_val+window_height+"|"+content_height);
if( scroll_val+window_height > content_height - 100 ){
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}else if( scroll_val < Math.round(window_height) ){
$("html").removeClass("scrolled")
$("html").removeClass("scrollend")
}else if( scroll_val >= Math.round(window_height) && scroll_val+window_height < content_height - 100 ){
$("html").addClass("scrolled")
$("html").removeClass("scrollend")
}else{
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}
if( $("html.iOS")[0] ){
scrollbar_height = parseInt(window_height * window_height / content_height);
$('.scrollbar_thumb').css('height', scrollbar_height);
var scrollbar_track = window_height - scrollbar_height;
var scrollbar_offset = scroll_val * scrollbar_track / (content_height - window_height);
$('.scrollbar_thumb').css('transform', 'translateY(' + scrollbar_offset + 'px)');
}
if( $("article#root > article#top div.slide")[0] ){
if( scroll_val < window_height*1.5 ){
$("article#root > article#top div.slide > ul.carousel").css({
"transform": "matrix(1, 0, 0, 1, 0, "+ (scroll_val/4) +")"
});
}
}
if( $("div#header_sub > div.bg > div.img > img")[0] ){
if( scroll_val < window_height*1.5 ){
$("div#header_sub > div.bg > div.img > img").each(function(){
$(this).css({
"transform": "matrix(1, 0, 0, 1, 0, "+ (scroll_val/4) +")"
});
});
}
}
if( $("img.parallax")[0] ){
var window_center_y = window_height/2;
$("img.parallax").each(function(){
var target = $(this);
var wrapper = $(this).parent();
if( target.height() <= wrapper.height() ){
target.css({"height": "120%" });
}
var wrapper_y = wrapper.offset().top;
var wrapper_center_y = wrapper_y + wrapper.height()/2;
var distance = window_center_y - wrapper_center_y;
var parallax_height = wrapper.height();
var img_height = target.height();
var val = img_height-parallax_height;
var move_y = Math.round((val/window_height)*distance*1000)/1000;
target.css({"transform": "matrix(1, 0, 0, 1, 0, "+ move_y +")"});
});
}
if( scroll_action_flag === true && $("body #container > div#base article.ground")[0] ){
scroll_action_flag = false;
if( typeof scroll_action_limiter != "undefined" ){
clearTimeout( scroll_action_limiter );
}
scroll_action_limiter = setTimeout(
function(){
$("body #container > div#base article.ground").each(function(){
if( $(this).attr("id") != null ){
var ground_id = $(this).attr("id");
if( typeof category[ground_id] != "undefined" ){
var ground_offset = $("#" + selectorEscape( ground_id )).position().top;
var ground_height = $("#" + selectorEscape( ground_id )).height();
if( scroll_val >= ground_offset && scroll_val <= ground_offset + ground_height ){
// console.log("ground_id::"+ground_id);
// console.log(id);
// console.log(ground_id);
var href = "https://k-renovation.com/" + ground_id;
// console.log("do");
PJAX_pjax( href, "by_scroll", "" );
}else if( scroll_val < $("body #container > div#base article.ground").first().position().top ){
if( $("body").attr("data-scroll") != "" ){
var scroll_split = $("body").attr("data-scroll").split('/');
var ground_directory = $("body").attr("data-scroll").replace( scroll_split[scroll_split.length-1], "" );
var href = "https://k-renovation.com/" + ground_directory;
// console.log("top::"+href);
// console.log("why");
PJAX_pjax( href, "by_scroll", "" );
}
}
}
}
});
// console.log("true");
scroll_action_flag = true;
}
, 1000);
}
}
function entry_scroll() {
scroll_val = $("#entry > div.inner").scrollTop();
if( $("#entry > div.inner > article")[0] ){
if( $("div#header_sub > div.bg > div.img > img")[0] ){
if( scroll_val < window_height*1.5 ){
$("div#header_sub > div.bg > div.img > img").each(function(){
$(this).css({
"transform": "matrix(1, 0, 0, 1, 0, "+ (scroll_val/4) +")"
});
});
}
}
scroll_val = $("#entry > div.inner").scrollTop();
// console.log(scroll_val+window_height+"|"+entry_height);
if( scroll_val+window_height > entry_height - 100 ){
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}else if( scroll_val < Math.round(window_height) ){
$("html").removeClass("scrolled")
$("html").removeClass("scrollend")
}else if( scroll_val >= Math.round(window_height) && scroll_val+window_height < entry_height - 100 ){
$("html").addClass("scrolled")
$("html").removeClass("scrollend")
}else{
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}
}
}
function window_resize() {
document_height = $(document).height();
content_height = get_total_height($("#container > div#base > *"));
entry_height = get_total_height($("#entry > div.inner > *"));
if( $("html.touch_device")[0] ){
if( window.innerHeight > window.innerWidth ){
window_height = $(window).height();
}else{
window_height = $(window).height();
}
}else{
window_height = window.innerHeight ? window.innerHeight: $(window).height();
}
window_width = $(window).width();
window_ratio = window_height / window_width;
if( window_ratio > 1 ){
$("html").removeClass("horizontal");
$("html").addClass("portrait");
}else{
$("html").removeClass("portrait");
$("html").addClass("horizontal");
}
if( window_ratio < 0.6 ){
$("html").addClass("panorama");
}else{
$("html").removeClass("panorama");
}
$("body").css({"height": window_height});
// if( $("article#root > article#top")[0] ){
// $("article#root > article#top").css({"height": window_height});
// }
// if( $("div.slide > ul")[0] ){
// var wrapper_ratio = $("div.slide > ul").height() / $("div.slide > ul").width();
// $("div.slide > ul li.cell").each(function(){
// var target_li = $(this);
// var target_img = $(this).find("div.img > img");
// target_img.imagesLoaded(function(){
// target_img.addClass("loaded");
// var img_ratio = target_img.height() / target_img.width();
// target_li.removeClass("horizontal vertical");
// if( wrapper_ratio < img_ratio ){
// target_li.addClass("vertical");
// }else{
// target_li.addClass("horizontal");
// }
// });
// });
// }
// if( $("div.slide.concept > ul")[0] ){
// var wrapper_ratio = $("div.slide.concept > ul").height() / $("div.slide.concept > ul").width();
// $("div.slide.concept > ul li.cell").each(function(){
// var target_li = $(this);
// var target_img = $(this).find("div.img > img");
// target_img.imagesLoaded(function(){
// target_img.addClass("loaded");
// var img_ratio = target_img.height() / target_img.width();
// target_li.removeClass("horizontal vertical");
// if( wrapper_ratio < img_ratio ){
// target_li.addClass("vertical");
// }else{
// target_li.addClass("horizontal");
// }
// });
// });
// }
base_scroll();
entry_scroll_bind();
entry_scroll();
}
var scroll_flug = true;
$("body #container > div#base").on("scroll.main",function(){
setTimeout(function(){
scroll_flug = true;
}, 10);
if(scroll_flug){
scroll_flug = false;
base_scroll();
}
});
function entry_scroll_bind(){
if( $("#entry > div.inner > article")[0] ){
$("html").removeClass("scrolled");
$("html").removeClass("scrollend");
$("#entry > div.inner").on("scroll.main",function(){
entry_scroll();
// if(scroll_flug){
// scroll_flug = false;
// base_scroll();
// setTimeout(function(){
// scroll_flug = true;
// return scroll_flug;
// }, 50);
// }
});
}
}
entry_scroll_bind();
$(window).bind("resize", window_resize);
function selectorEscape(val){
return val.replace(/\//g, '\\/');
}
function video_stop(){
$("article#top > div.inner > div.video > ul > li.video_1.part").removeClass("active");
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_1.part > div").empty();
$("article#top > div.inner > div.video > ul > li.video_2.part").removeClass("active");
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_2.part > div").empty();
},1000);
},1000);
}
function video_play(){
if( $("body.root")[0] ){
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_1.part").addClass("active");
create_video( $("article#top > div.inner > div.video > ul > li.video_1.part > div") , "https://k-renovation.com/elements/video_01" , "video_01" );
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.video_2.part").addClass("active");
create_video( $("article#top > div.inner > div.video > ul > li.video_2.part > div") , "https://k-renovation.com/elements/video_02" , "video_02" );
setTimeout(function(){
$("article#top > div.inner > div.video > ul > li.part > div > img").fadeIn(1000);
},1000);
},500);
},4000);
}
// if( $("body.root")[0] ){
// setTimeout(function(){
// $("article#top > div.inner > div.video > ul > li.video_1.part").addClass("active");
// create_video( $("article#top > div.inner > div.video > ul > li.video_1.part > div") , "http://test:1111@leafbrand.co.jp/elements/video_01" , "video_01" );
// setTimeout(function(){
// $("article#top > div.inner > div.video > ul > li.video_2.part").addClass("active");
// create_video( $("article#top > div.inner > div.video > ul > li.video_2.part > div") , "http://test:1111@leafbrand.co.jp/elements/video_02" , "video_02" );
// setTimeout(function(){
// $("article#top > div.inner > div.video > ul > li.part > div > img").fadeIn(1000);
// },1000);
// },500);
// },4000);
// }
}
function create_video(target, video_file, target_id) {
if( $("html.touch_device.iOS")[0] ) {
var width = target.outerWidth();
var height = target.outerHeight();
target.append('
');
setTimeout(function(){
target.parent().addClass("play");
var video = document.createElement('video');
video.style.display = 'none';
document.body.appendChild(video);
var canvas = document.getElementById('video_canvas_'+target_id);
$(canvas).css({"display": "block"});
var ctx = canvas.getContext("2d");
var ctime = 0;
var lastTime;
video.addEventListener('canplay',function(){
lastTime = Date.now();
setInterval(function(){
var curTime = Date.now();
var diff = Date.now() - lastTime;
lastTime = curTime;
ctime += diff/1000;
video.currentTime = ctime;
ctx.drawImage(video, 0, 0, width, height);
if(video.duration <= video.currentTime){
ctime = 0;
}
}, 1000/30);
},false);
video.src = video_file +'.mp4?24042721';
video.load();
},1000);
}else{
target.append('
');
setTimeout(function(){
target.parent().addClass("play");
target.find("video").each(function(){
if( ! $(this).hasClass("play") ){
$(this).addClass("play");
$(this).get(0).play();
}
});
},1000);
}
}
function load_iframe(){
$("iframe.preload:not('.loaded')").each(function(){
$(this).load(function(){
$(this).addClass("loaded");
});
});
}
load_iframe();
$("html").data("preloaded", 0);
function preload(){
var img = [],
img_arr = $("img:not([src*='.pdf']).preload"), // ローディング対象の画像を指定
img_arr_lngth = img_arr.size();
var img_arr_lngth_total = img_arr_lngth;
if( img_arr_lngth_total > 0 ){
img_arr.each(function(indx){
img[indx] = new Image();
img[indx].onload = function(){
img_arr_lngth = img_arr_lngth - 1;
var progress = Math.round((1-img_arr_lngth/img_arr_lngth_total)*100);
$("div.progress").stop().animate({"width": progress + "%"},2000);
// console.log(progress);
if( 0 >= img_arr_lngth ){
window_resize();
$("html").data("preloaded", 1);
$("div.progress").stop().animate({"width": "100%"},1500,"easeOutQuad",function(){
setTimeout(function(){
$("div.progress").addClass("out");
setTimeout(function(){
$("div#preloader").fadeOut(1000, function() {
$(this).remove();
$("html").addClass("start");
if( $("article#root > article#top div.slide")[0] ) {
slide_start( $("body #container > div#base > article#root > article#top > div.inner > div.slide") );
}
});
},200);
},200);
});
}
};
img[indx].src = $(this).attr('src');
});
}else{
$("html").data("preloaded", 1);
$("div#progress").stop().animate({"width": "100%"},1500,"easeOutQuad",function(){
$.getScript("https://k-renovation.com/js/3d.js?1707063", function(){
});
setTimeout(function(){
$("div.progress").addClass("out");
setTimeout(function(){
$("div#preloader").fadeOut(2000, function() {
$(this).remove();
window_resize();
});
},1000);
},200);
});
}
}
function img_load(){
$("img.preload:not('.loaded')").each(function(){
$(this).imagesLoaded(function(){
$(this).addClass("loaded");
});
});
}
var watch_target = document.getElementById('base');
var article_id = "";
function watch_reflesh(){
var observer = new MutationObserver(function() {
article_id = $("body #container > div#base > article:not(.leave)").attr("id");
if( article_id == "login/" && $("#login_complete")[0] ){
var href = "https://k-renovation.com/accounts/";
PJAX_pjax( href, "", "" );
}
});
observer.observe(watch_target, { childList: true, subtree: true });
}
$("div#preloader > div.bg > div.logo_wrapper > img.logo").imagesLoaded(function(){
$("div#preloader > div.bg").addClass("show");
preload();
});
$(window).bind('load', function() {
img_load();
// window_resize();
if( $("body #container > div#base article.ground")[0] ){
scroll_action_flag = false;
var target = $("#" + selectorEscape($("body").attr("data-scroll")));
if( target[0] ){
var val = target.position().top + 10;
scrollto(val);
}
}
watch_reflesh();
});
function video_start(target_video_selector) {
if( $(target_video_selector)[0] ){
var player = $(target_video_selector).get(0);
player.play();
}
}
function rnd(n){
return Math.floor(Math.random()*(n+1));
}
function slide_switch(target_wrapper, past_target, next_target, slide_interval) {
var next_id = next_target.attr("id");
target_wrapper.children("ul.dots").find("li").removeClass("active");
var next_dot = target_wrapper.find("."+next_id).addClass("active");
if( past_target != "" ){
past_target.addClass("pending active");
}
img_url = next_target.find("div.img").attr("data-img-url");
next_target.find("div.slide.img > img").imagesLoaded(function(){
next_target.addClass("active");
if( past_target != "" ){
setTimeout(function(){
past_target.removeClass("pending active");
},500);
}
video_range = "";
if( next_target.find("div.video_wrapper video")[0] ){
var video_elm = next_target.find("div.video_wrapper video");
var wrapper = video_elm.closest("div.video_wrapper");
var video_id = wrapper.attr("id");
video_start("#"+video_id+" video");
if( typeof video_elm.attr("data-range") !== 'undefined' && video_elm.attr("data-range") !== false ){
video_range = video_elm.attr("data-range");
}
slide_repeat(target_wrapper, slide_interval, video_range);
}else{
slide_repeat(target_wrapper, slide_interval);
}
});
next_target.find("div.slide.img > img").attr("src", img_url);
}
function slide_repeat(target_wrapper, slide_interval, video_range ) {
if(typeof video_range === 'undefined') video_range = "";
if( video_range != "" ){
set_slide_interval = video_range;
}else{
set_slide_interval = slide_interval;
}
console.log(set_slide_interval);
var max_num = target_wrapper.find("ul.carousel > li.cell").length;
if( typeof timerId_slide != "undefined" ){
clearTimeout(timerId_slide);
}
timerId_slide = setTimeout(function(){
if( max_num > 1 ){
var past_target = target_wrapper.find("ul.carousel > li.cell.active");
var next_target = "";
if( past_target.next("li")[0] ){
if( ! past_target.next("li").next("li")[0] ){
$("body #container > div#base > article#root > article#top > div.inner > header").addClass("active");
}
next_target = past_target.next("li");
// slide_switch(target_wrapper, past_target, next_target, slide_interval);
}else{
next_target = target_wrapper.find("ul.carousel > li.cell").first();
}
slide_switch(target_wrapper, past_target, next_target, slide_interval);
}else{
clearTimeout(timerId_slide);
}
}, set_slide_interval );
}
window.slide_start = function( target_wrapper, slide_interval ){
if(typeof slide_interval === 'undefined') slide_interval = 8000;
// audio_init();
target_wrapper.addClass("active");
target_wrapper.append('
');
target_wrapper.find("ul.carousel > li.cell").each(function(i){
var set_class = $(this).attr("id");
target_wrapper.children("ul.dots").append('
');
});
var max_num = target_wrapper.find("ul.carousel > li.cell").length;
// var first_target = target_wrapper.find("ul.carousel > li.cell").eq(rnd(max_num-1));
var first_target = target_wrapper.find("ul.carousel > li.cell").eq(0);
var img_url = first_target.find("div.img").attr("data-img-url");
first_target.find("div.slide.img > img").imagesLoaded(function(){
slide_switch(target_wrapper, "", first_target, slide_interval);
slide_repeat(target_wrapper, slide_interval);
});
first_target.find("div.slide.img > img").attr("src", img_url);
target_wrapper.children("ul.dots").find("li").click(function(){
if( !$(this).hasClass("active") ){
var past_target = target_wrapper.find("ul.carousel > li.cell.active");
var next_target = target_wrapper.find("ul.carousel > li.cell#"+$(this).attr("class"));
slide_switch(target_wrapper, past_target, next_target, slide_interval);
}
})
}
$(document).on("click", "article#root > article#top div.slide > ul.carousel > li.cell > a[data-link-to-flag='media']", function(){
return false;
});
$(document).on("click", "div.list.faq > div.media_list > dl > dt.over", function() {
$(this).next("dd").slideToggle();
return false;
});
function get_total_height(elms) {
var total_height = 0;
elms.each(function(i){
var height = $(this).outerHeight(true);
total_height += height;
});
return total_height;
}
$(document).on("click", "div.partially_reform_area > div.inner > section.partially_reform_detail > div.inner > dl.reform_contents > dt > div.inner > div.details_btn.sp", function() {
$(this).closest("dl").addClass("open");
});
$(document).on("click", "div.partially_reform_area > div.inner > section.partially_reform_detail > div.inner > dl.reform_contents.open > dt > div.inner > div.details_btn.sp", function() {
$(this).closest("dl").removeClass("open");
});
$(document).on("click", "div.partially_reform_area > div.inner > section.partially_reform_detail > div.inner > dl.reform_contents.open > dd > div.inner > div.close_btn.sp", function() {
$(this).closest("dl").removeClass("open");
});
});