$(function() { category = Array(); category['about'] = Array(); category['about'][0] = "ABOUT"; category['about'][1] = "about Studio KU+"; category['about'][2] = "modal"; category['work'] = Array(); category['work'][0] = "WORK"; category['work'][1] = "Studio KU+ projects browser"; category['work'][2] = "index"; category['work/architecture'] = Array(); category['work/architecture'][0] = "WORK/ARCHITECTURE"; category['work/architecture'][1] = "architectural models"; category['work/architecture'][2] = "index"; category['work/urban-design'] = Array(); category['work/urban-design'][0] = "WORK/URBAN DESIGN"; category['work/urban-design'][1] = "urban design models"; category['work/urban-design'][2] = "index"; category['work/culture'] = Array(); category['work/culture'][0] = "WORK/CULTURE"; category['work/culture'][1] = "culture models"; category['work/culture'][2] = "index"; category['work/product'] = Array(); category['work/product'][0] = "WORK/PRODUCT"; category['work/product'][1] = "product project"; category['work/product'][2] = "index"; category['news'] = Array(); category['news'][0] = "NEWS"; category['news'][1] = "Studio KU+ updates"; category['news'][2] = "index"; category['news/exhibition'] = Array(); category['news/exhibition'][0] = "NEWS/EXHIBITION"; category['news/exhibition'][1] = "exhibition announcement"; category['news/exhibition'][2] = "index"; category['news/event'] = Array(); category['news/event'][0] = "NEWS/EVENT"; category['news/event'][1] = "event announcement"; category['news/event'][2] = "index"; category['news/other'] = Array(); category['news/other'][0] = "NEWS/OTHER"; category['news/other'][1] = "diverse announcement"; category['news/other'][2] = "index"; category['contact'] = Array(); category['contact'][0] = "CONTACT"; category['contact'][1] = "Studio KU+ contact detail"; category['contact'][2] = "modal"; category['search'] = Array(); category['search'][0] = "SEARCH"; category['search'][1] = "documents search"; category['search'][2] = "modal"; var history_counter = 0; var past_href = location.href; var past_href_search = ""; var memorize_scrolltop = $(window).scrollTop(); var memorize_lastvisit = "entry"; var root_url = "https://www.studiokuplus.com/"; var past_entry_id = ""; var id = "news/other"; if(past_href.indexOf( "https://www.studiokuplus.com/search/" ) != -1){ past_href_search = past_href; } if( id != "" && category[id][2] == "modal" ){ memorize_past_id = ""; }else{ memorize_past_id = $("div#index > article").attr("class").replace( " ", "/" ); } if( id == "" ){ $("div#index > article").attr("class", "root") } if( id.indexOf( "/" ) == -1 ){ $("div#index").addClass("root"); $("div#index").removeClass("sub"); }else{ $("div#index").addClass("sub"); $("div#index").removeClass("root"); } PJAX_show_category_menu(id); memorize_lasturl = location.href; profile_url = "about"; var hash = ""; if(past_href.indexOf( "#/" ) != -1){ hash_arr = past_href.split("#/"); past_href = hash_arr[0]; hash = hash_arr[1]; PJAX_hash( hash ); } $(window).bind('load', function() { var target_nav = $("li.class_" + id.replace( "/", "_" )); target_nav.removeClass("over"); target_nav.addClass("active"); if(id.indexOf( "/" ) != -1){ var id_arr = id.split('/'); var parent_id = id_arr[0]; var target_nav = $("li.class_p_" + parent_id); target_nav.removeClass("over"); target_nav.addClass("active"); $("#header nav li:not(.class_p_" + parent_id + ") > a").next("div.sub").removeClass("show"); $("#header nav li.class_p_" + parent_id + " > a").next("div.sub").addClass("show"); if( memorize_lastvisit != "entry" ){ var target_thm = $("ul#list li[data-category *= '" + category[id][0] + "' ]"); if( target_thm[0] ){ var scrollto = target_thm.first().offset().top - 300; }else{ var scrollto = $(document).height(); } $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } }else{ var target_nav = $("li.class_p_" + id); target_nav.removeClass("over"); target_nav.addClass("active"); $("#header nav li:not(.class_p_news/other) > a").next("div.sub").removeClass("show"); $("#header nav li.class_p_news/other > a").next("div.sub").addClass("show"); if( memorize_lastvisit != "entry" && id != "" && category[id][2] != "modal" ){ var scrollto = $("#container").offset().top - 300; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } } }); function PJAX_hrefchange( href, onpop ) { if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } var hash = ""; if(href.indexOf( "#/" ) != -1){ hash_arr = href.split("#/"); href = hash_arr[0]; hash = hash_arr[1]; PJAX_hash( hash ); } var search_words = ""; var search_words_url = ""; if(href.indexOf( "https://www.studiokuplus.com/search/" ) != -1){ search_words = href.replace( "https://www.studiokuplus.com/search/", "" ); search_words_url = "/"+search_words; past_href_search = href; }else{ $("#navi_toggle > #search_menu > .input_wrapper > input").val(''); $("#entry article.search > div.body > #search > .input_wrapper > input").val(''); } if( href && past_href != href ){ past_href = href; if( search_words == "" ){ var id = href.replace( "https://www.studiokuplus.com/", "" ); var id = id.replace( "?mode=preview", "" ); }else{ var id = "search"; } if(memorize_past_id.indexOf( "/" ) != -1){ var memorize_past_id_arr = memorize_past_id.split('/'); var parent_past_id = memorize_past_id_arr[0]; }else{ var parent_past_id = memorize_past_id; } ajax_request = $.ajax({ url: "https://www.studiokuplus.com/pjax_readtitle_json.php", data: "id=" + id + search_words_url + "&type=json" + "", dataType: "json", success: function(data, dataType){ if(!onpop){ PJAX_pushState( href , data.title ); } document.title = data.title; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); if( id == "" ){ $("html").addClass("root"); $("div#index").removeClass("sub"); $("div#index").addClass("root"); }else{ $("html").removeClass("root"); } if (id.match(/\d{4}$/)) { var entry_id = id.match(/\d{4}$/); var category_filter = id.replace("/" + entry_id ,""); if( entry_id != "" && category_filter != "" && entry_id != category_filter ){ $("body").append("
"); if( memorize_lastvisit == "entry"){ $('html,body').animate({ scrollTop: memorize_scrolltop }, '200'); }else{ memorize_scrolltop = $(window).scrollTop(); } ajax_request = $.ajax({ url: "https://www.studiokuplus.com/ajax_entry.php", data: "id=" + category_filter + "/" + entry_id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", memorize_scrolltop + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $(this).remove(); if(past_href_search.indexOf( "https://www.studiokuplus.com/search/" ) != -1){ $("#entry a.close").attr("href",past_href_search); $("#entry .modal_overlay").attr("href",past_href_search); } past_href_search = ""; } ); } ); } ); memorize_lastvisit = "entry"; memorize_lasturl = href; memorize_past_id = category_filter; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); }else if( entry_id != "" ){ $("body").append("
"); if( memorize_lastvisit == "entry"){ $('html,body').animate({ scrollTop: memorize_scrolltop }, '200'); }else{ memorize_scrolltop = $(window).scrollTop(); } ajax_request = $.ajax({ url: "https://www.studiokuplus.com/ajax_entry.php", data: "id=" + entry_id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", memorize_scrolltop + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $(this).remove(); if(past_href_search.indexOf( "https://www.studiokuplus.com/search/" ) != -1){ $("#entry a.close").attr("href",past_href_search); $("#entry .modal_overlay").attr("href",past_href_search); } past_href_search = ""; } ); } ); } ); memorize_lastvisit = "entry"; memorize_lasturl = href; memorize_past_id = ""; }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } } if ( id == profile_url ) { $("body").append("
"); ajax_request = $.ajax({ url: "https://www.studiokuplus.com/ajax_profile.php", data: "id=" + id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", $(window).scrollTop() + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $("div#entry > a.modal_overlay, div#entry > a.close").attr("href", root_url + memorize_past_id); // initialize_gmap("https://www.studiokuplus.com/","ajax"); $(this).remove(); past_href_search = ""; PJAX_hash( hash ); } ); } ); } ); memorize_lastvisit = "profile"; memorize_lasturl = href; memorize_scrolltop = $(window).scrollTop(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); }else if ( typeof category[id] != "undefined" && category[id][2] == "modal" ) { memorize_scrolltop = $(window).scrollTop(); $("body").append("
"); if( search_words == "" ){ ajax_request = $.ajax({ url: "https://www.studiokuplus.com/ajax_entry.php", data: "id=" + id + "", success: function(data, dataType){ $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", $(window).scrollTop() + "px"); $(this).empty().append(data).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $("div#entry a.modal_overlay, div#entry a.close").attr("href", root_url + memorize_past_id); initialize_gmap("https://www.studiokuplus.com/","ajax"); $(this).remove(); past_href_search = ""; } ); } ); } ); memorize_lastvisit = "entry"; memorize_lasturl = href; memorize_scrolltop = $(window).scrollTop(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); }else{ ajax_request = $.ajax({ url: "https://www.studiokuplus.com/", data: "id=" + id + search_words_url + "", dataType: "html", success: function(data, dataType){ var get_elm = $('#entry > *', $('
').prepend(data)); $("div#entry").fadeOut( 400, function(){ $("div#entry").css("top", $(window).scrollTop() + "px"); $(this).empty().append(get_elm).fadeIn( 400,function(){ $("div#loading").fadeOut(600, function(){ $("div#entry a.modal_overlay, div#entry a.close").attr("href", root_url + memorize_past_id); $(this).remove(); } ); } ); } ); memorize_lastvisit = "entry"; memorize_lasturl = href; memorize_scrolltop = $(window).scrollTop(); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } }else if( typeof entry_id == "undefined" && id != "" ){ if( memorize_lastvisit == "entry" || memorize_lastvisit == "profile" || memorize_lastvisit == "static" ){ if( memorize_past_id == id ){ var scrollto = memorize_scrolltop; }else{ var scrollto = 0; } $('html,body').animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); $("ul#list").css({ opacity : 1 } ); $("div#entry").stop().animate({ opacity : 0 },200, function(){ $("div#entry").empty().stop().animate({opacity : 1},200); } ); }else{ var scrollto = 0; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } if( id != memorize_past_id ){ $("#container > #index > article > ul").css({"opacity": 0}); if( typeof( PJAX_timeout ) != 'undefined' ){ clearTimeout( PJAX_timeout ); } PJAX_timeout = setTimeout( function(){ $("#container > #index > article > ul > li.thm").removeClass("on off"); $("li.load_more > a").attr("data-id",id); var next_page = $("li.load_more > a").attr("data-page"); $("li.load_more > a").attr("href","https://www.studiokuplus.com/"+id+"/"+next_page); thmArr = []; PJAX_thumb_i = 0; $("#container > #index > article > ul > li.thm").each(function(){ thmArr.push($(this)); PJAX_thumb_i ++; }); if( id.indexOf( "/" ) == -1 ){ $("div#index").removeClass("sub"); $("div#index").addClass("root"); }else{ $("div#index").removeClass("root"); $("div#index").addClass("sub"); } var delay_i = 1; for(var i = 0 ; i < PJAX_thumb_i ; i++){ var target = thmArr[i]; var get_category = target.attr("data-category"); var get_href = target.find(".tagswitch").attr("data-href"); var get_inner_html = target.find(".tagswitch").html(); if( get_category.indexOf(category[id][0]) != -1 || id.indexOf( "/" ) == -1 ){ target.find(".tagswitch").replaceWith(''+get_inner_html+'') target.addClass("on"); delay_i ++; }else{ target.find(".tagswitch").replaceWith('
'+get_inner_html+'
') target.addClass("off"); } } setTimeout(function(){ $("#container > #index > article > ul").css({"opacity": 1}); },1000); } , 500); } memorize_lastvisit = "index"; memorize_lasturl = href; memorize_scrolltop = 0; memorize_past_id = id; } if( id == "" ){ past_href_search = ""; if( memorize_lastvisit == "entry" || memorize_lastvisit == "profile" || memorize_lastvisit == "static" ){ $('html,body').animate({ scrollTop: memorize_scrolltop }, 200); $("ul#list").css({ opacity : 1 } ); $("div#entry").stop().animate({ opacity : 0 },200, function(){ $("div#entry").empty().stop().animate({opacity : 1},200); memorize_scrolltop = 0; } ); if( id != memorize_past_id ){ var scrollto = 0; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); $("#container > #index > article > ul").css({"opacity": 0}); if( typeof( PJAX_timeout ) != 'undefined' ){ clearTimeout( PJAX_timeout ); } PJAX_timeout = setTimeout( function(){ $("#container > #index > article > ul > li.thm").removeClass("on off"); thmArr = []; PJAX_thumb_i = 0; $("#container > #index > article > ul > li.thm").each(function(){ thmArr.push($(this)); PJAX_thumb_i ++; }); for(var i = 0 ; i < PJAX_thumb_i ; i++){ var target = thmArr[i]; target.removeClass("on off"); var get_href = target.find(".tagswitch").attr("data-href"); var get_inner_html = target.find(".tagswitch").html(); target.find(".tagswitch").replaceWith(''+get_inner_html+'') target.addClass("on"); } setTimeout(function(){ $("#container > #index > article > ul").css({"opacity": 1}); },1000); } , 500); } }else{ var scrollto = 0; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); $("#container > #index > article > ul").css({"opacity": 0}); if( typeof( PJAX_timeout ) != 'undefined' ){ clearTimeout( PJAX_timeout ); } PJAX_timeout = setTimeout( function(){ $("#container > #index > article > ul > li.thm").removeClass("on off"); thmArr = []; PJAX_thumb_i = 0; $("#container > #index > article > ul > li.thm").each(function(){ thmArr.push($(this)); PJAX_thumb_i ++; }); for(var i = 0 ; i < PJAX_thumb_i ; i++){ var target = thmArr[i]; target.removeClass("on off"); var get_href = target.find(".tagswitch").attr("data-href"); var get_inner_html = target.find(".tagswitch").html(); target.find(".tagswitch").replaceWith(''+get_inner_html+'') target.addClass("on"); } setTimeout(function(){ $("#container > #index > article > ul").css({"opacity": 1}); },1000); } , 500); } $("li.load_more > a").attr("data-id",""); var next_page = $("li.load_more > a").attr("data-page"); $("li.load_more > a").attr("href","https://www.studiokuplus.com/"+"/"+next_page); memorize_lastvisit = "root"; memorize_lasturl = href; memorize_past_id = id; } if( typeof entry_id == "undefined" ){ $("#header nav li a").css({ "border-bottom-color" : "" }); $("#header nav li").removeClass("active"); $("#header nav li").addClass("over"); var target_nav = $("li.class_" + id.replace( "/", "_" )); target_nav.removeClass("over"); target_nav.addClass("active"); $("nav > ul > li > a").stop().animate({opacity:0.7},100); if( id != "" ){ $("div#index > article").attr("class", id.replace( "/", " " )) }else{ $("div#index > article").attr("class", "root") } if(id.indexOf( "/" ) != -1){ var id_arr = id.split('/'); var parent_id = id_arr[0]; var target_nav = $("li.class_p_" + parent_id); target_nav.removeClass("over"); target_nav.addClass("active"); $("#header nav li:not(.class_p_" + parent_id + ") > a").next("div.sub").removeClass("show"); $("#header nav li.class_p_" + parent_id + " > a").next("div.sub").addClass("show"); PJAX_show_category_menu(id); setTimeout(function(){ $("ul#list").removeClass(); $("ul#list").addClass(parent_id); $("ul#list.root figure:not(.img_off) .text_wrapper").css({ opacity : 0 }); $("ul#list:not(.root) .text_wrapper").css({ opacity : 1 }); },500); }else if( id != "" && id != profile_url && category[id][2] != "modal" ){ if( typeof parent_past_id != "undefined" && id != parent_past_id ){ setTimeout(function(){ $("ul#list").removeClass(); $("ul#list").addClass(id); $("ul#list.root figure:not(.img_off) .text_wrapper").css({ opacity : 0 }); $("ul#list:not(.root) .text_wrapper").css({ opacity : 1 }); PJAX_vertical_align(); },500); }else{ $("ul#list").removeClass(); $("ul#list").addClass(id); $("ul#list.root figure:not(.img_off) .text_wrapper").css({ opacity : 0 }); $("ul#list:not(.root) .text_wrapper").css({ opacity : 1 }); } var target_nav = $("li.class_p_" + id); target_nav.removeClass("over"); target_nav.addClass("active"); $("#header nav li a:not(.class_p_" + id + ")").next("div.sub").removeClass("show"); $("#header nav li a.class_p_" + id).next("div.sub").addClass("show"); PJAX_show_category_menu(id); }else if( id == profile_url ){ $("#header nav li > a").next("div.sub").removeClass("show"); // $("ul#list").removeClass(); // $("ul#list").addClass("root"); // $("ul#list.root figure:not(.img_off) .text_wrapper").css({ // opacity : 0 // }); // $("ul#list:not(.root) .text_wrapper").css({ // opacity : 1 // }); }else if( id != "" && category[id][2] == "modal" ){ $("div.sub").removeClass("show"); // $("ul#list").removeClass(); // $("ul#list").addClass("root"); var target_nav = $(".class_p_" + id.replace( "/", "_" )).parent("li"); target_nav.removeClass("over"); target_nav.addClass("active"); }else{ if( typeof parent_past_id != "undefined" && parent_past_id != "root" && parent_past_id != "" ){ setTimeout(function(){ $("ul#list").removeClass(); $("ul#list").addClass("root"); $("ul#list.root figure:not(.img_off) .text_wrapper").css({ opacity : 0 }); $("ul#list:not(.root) .text_wrapper").css({ opacity : 1 }); PJAX_vertical_align(); },500); }else{ setTimeout(function(){ $("ul#list").removeClass(); $("ul#list").addClass("root"); $("ul#list.root figure:not(.img_off) .text_wrapper").css({ opacity : 0 }); $("ul#list:not(.root) .text_wrapper").css({ opacity : 1 }); PJAX_vertical_align(); },500); } $("#header nav li").addClass("over"); $("#header nav li").removeClass("active"); // var target_nav = $("li.class_work"); // target_nav.removeClass("over"); // target_nav.addClass("active"); // var target_nav = $("li.class_p_work"); // target_nav.removeClass("over"); // target_nav.addClass("active"); $("#header nav li:not(.class_p_work) > a").next("div.sub").removeClass("show"); $("#header nav li.class_p_work > a").next("div.sub").addClass("show"); } } } } function PJAX_pushState( href, title ) { if ( window.history.pushState ) { window.history.pushState( title, null, href ); } else { } } function PJAX_hash( hash ) { if( $("#"+hash)[0] ){ var scrollto = $("#"+hash).first().offset().top - 100; } $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); } window.onpopstate = function(event){ var onpop = true; if( history_counter != 0 ){ if (event.state) { } else { } var href = location.href; if ( window.history.pushState ) { PJAX_hrefchange( href, onpop ); history_counter++; } else { var href = "https://www.studiokuplus.com/#!/" + href.replace( /^.\//, '' ); window.location = href; history_counter++; } } history_counter++; } $(document).on("click", "a.pjax", function(){ var href = $(this).attr("href"); if ( window.history.pushState ) { PJAX_hrefchange( href ); history_counter++; } else { var href = href.replace( "https://www.studiokuplus.com/", "" ); var href = "https://www.studiokuplus.com/#!/" + href.replace( /^.\//, '' ); window.location = href; history_counter++; } return false; }); $(document).on("click", "#entry article.search > div.body > #search > .icon_search", function(){ var site_root = $(this).closest("div#search").attr("data-site_root"); var word = $(this).closest("div#search").find("input").val(); if( word != "" ){ if ( window.history.pushState ) { PJAX_hrefchange( site_root + "search/" + word ); history_counter++; }else{ window.location = site_root + "search/" + word; } $(this).closest("div#search").find("input").blur(); $("#header").removeClass("show"); $("#header > nav").removeClass("show"); $("#navi_toggle").removeClass("open"); } }); $(document).on("keyup", "#entry article.search > div.body > #search > .input_wrapper > input", function(e) { if ( e.which == 13 ) { var site_root = $(this).closest("div#search").attr("data-site_root"); var word = $(this).val(); if( word != "" ){ if ( window.history.pushState ) { PJAX_hrefchange( site_root + "search/" + word ); history_counter++; }else{ window.location = site_root + "search/" + word; } $(this).blur(); $("#header").removeClass("show"); $("#header > nav").removeClass("show"); $("#navi_toggle").removeClass("open"); } return false; } }); $(document).on("click", "#search_menu > .icon_search", function(){ var site_root = $(this).closest("div#search_menu").attr("data-site_root"); var word = $(this).closest("div#search_menu").find("input").val(); if( word != "" ){ if ( window.history.pushState ) { PJAX_hrefchange( site_root + "search/" + word ); history_counter++; }else{ window.location = site_root + "search/" + word; } $(this).closest("div#search_menu").find("input").blur(); $("#header").removeClass("show"); $("#header > nav").removeClass("show"); $("#navi_toggle").removeClass("open"); } }); $(document).on("keyup", "#search_menu > .input_wrapper > input", function(e) { if ( e.which == 13 ) { var site_root = $(this).closest("div#search_menu").attr("data-site_root"); var word = $(this).val(); if( word != "" ){ if ( window.history.pushState ) { PJAX_hrefchange( site_root + "search/" + word ); history_counter++; }else{ window.location = site_root + "search/" + word; } $(this).blur(); $("#header").removeClass("show"); $("#header > nav").removeClass("show"); $("#navi_toggle").removeClass("open"); } return false; } }); $(window).hashchange( function(){ var hash = location.hash; if( hash.indexOf( "#!/" ) != -1 ){ var href = hash.replace( /^#!\//, '' ); if( href == "" ){ var href = "https://www.studiokuplus.com/"; } } PJAX_hrefchange( href ); }) $(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_hrefchange( href ); } } }); function PJAX_vertical_align() { y = 0; prev_y = 0; vertical_align = ""; thmArr = []; PJAX_thumb_i = 0; $("#container > #index > article > ul > li.thm").each(function(){ thmArr.push($(this)); PJAX_thumb_i ++; }); $("#container > #index > article > ul > li.thm").removeClass("vertical_align_top vertical_align_bottom"); for(var i = 0 ; i < PJAX_thumb_i ; i++){ var y = Math.round(thmArr[i].offset().top); if( thmArr[i-1] ){ var prev_target = thmArr[i-1]; prev_y = Math.round(prev_target.offset().top); } if( y - prev_y > 100 ){ if( vertical_align != "bottom" ){ vertical_align = "bottom"; }else if( vertical_align != "top" ){ vertical_align = "top"; } } thmArr[i].addClass("vertical_align_" + vertical_align); } } function PJAX_show_category_menu(id) { if( id != "" ){ var id_arr = id.split('/'); var parent_id = id_arr[0]; var target_nav = $(".class_p_" + parent_id); var set_menu = target_nav.children("div.sub"); $("#sub_menu").empty().append("

" + category[parent_id][0] + "

"); $("#sub_menu").append(set_menu.clone(true)); } } $(document).on("click", "aside.privacy > div.inner > div.close", function(){ $(this).closest("aside.privacy").remove(); $("body").removeClass("not_accept"); }); $(document).on("click", "aside.privacy > div.inner > div.accept", function(){ var key = "accept"; $(this).closest("aside.privacy").remove(); change_settings(key); }); function change_settings( key ) { if( typeof ajax_request != "undefined" ){ ajax_request.abort(); } ajax_request = $.ajax({ type: "POST", url: "https://www.studiokuplus.com/elements_php/ajax_change_settings.php", data: "key=" + key, success: function(data, dataType){ $("body").removeClass("not_accept"); }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } });