').prepend(ajax_data));
$("#container > div#base > article").addClass("leave");
$("#container > div#base").append(get_elm);
$("#container > div#base > article").addClass("ajax");
setTimeout(
function(){
$("#container > div#base > article.leave").remove();
window_resize();
FB.XFBML.parse();
var scrollto_val = 0;
if( scroll != "" ){
scrollto_val = $("#" + selectorEscape(scroll)).position().top;
}
scrollto(scrollto_val);
img_load();
}
, 500);
scroll_action_flag = true;
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
function PJAX_ajaxload_loadmore( 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();
scroll_action_flag = true;
var target_index = target.closest(".index");
thm_random_fade_start( target_index );
},
error:
function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
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 = "http://fes.tobiu.com/2017/#!/" + 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( "http://fes.tobiu.com/2017/", "" );
var href = "http://fes.tobiu.com/2017/#!/" + 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).hashchange( function(){
var hash = location.hash;
if( hash.indexOf( "#!/" ) != -1 ){
var href = hash.replace( /^#!\//, '' );
if( href == "" ){
var href = "http://fes.tobiu.com/2017/";
}
PJAX_pjax( 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_pjax( href, "", "" );
}
}
});
function scroll_trigger() {
if( $(".scroll_trigger")[0] ){
var target = $(".scroll_trigger");
var length = target.length;
for(var i=0; i
800 ){
var tracking = 0.5;
move_y -= window_height/5;
}else{
var tracking = 0.25;
move_y -= window_height/4;
}
if( target_parallax.attr("data-tracking") ){
var tracking = target_parallax.attr("data-tracking");
}
target_parallax.css({"transform": "matrix(1, 0, 0, 1, 0, "+ -move_y*tracking +")"});
}
}
if(target.eq(i).hasClass('action')) continue;
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.eq(i).addClass('action');
if( target.eq(i).find(".index")[0] ){
var target_index = target.eq(i).find(".index");
setTimeout(function(){
thm_random_fade_start( target_index );
},200);
}
}
}
}
}
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();
if( $("html.touch_device")[0] ){
var window_height = screen.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 window_action() {
scroll_trigger();
scroll_val = $("body #container > div#base").scrollTop();
if( scroll_val < Math.round(window_height/5) ){
$("html").removeClass("scrolled")
$("html").removeClass("scrollend")
}else if( scroll_val >= Math.round(window_height/5) && scroll_val+window_height < document_height ){
$("html").addClass("scrolled")
$("html").removeClass("scrollend")
}else{
$("html").addClass("scrolled")
$("html").addClass("scrollend")
}
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(id);
// console.log(ground_id);
var href = "http://fes.tobiu.com/2017/" + ground_id;
// console.log("scroll::"+href);
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 = "http://fes.tobiu.com/2017/" + ground_directory;
// console.log("top::"+href);
PJAX_pjax( href, "by_scroll", "" );
}
}
}
}
});
scroll_action_flag = true;
}
, 1000);
}
}
function window_resize() {
document_height = $(document).height();
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( $("body #container > div#base > article")[0] ){
var article_margin = (window_height - $("body #container > div#base > article").height())/2;
if( article_margin < 0 ){
article_margin = 0;
}
$("body #container > div#base > article").css({"padding-top": article_margin,"padding-bottom": article_margin});
// console.log(article_margin);
}
if( $("#profile_slide")[0] ){
var profile_slide_ratio = $("#profile_slide").height() / $("#profile_slide").width();
$("#profile_slide > ul > li").each(function(){
var target_li = $(this);
var target_img = $(this).find("img");
target_img.imagesLoaded(function(){
target_img.addClass("loaded");
var img_ratio = target_img.height() / target_img.width();
target_li.removeClass("horizontal vertical");
if( profile_slide_ratio < img_ratio ){
target_li.addClass("vertical");
}else{
target_li.addClass("horizontal");
}
});
});
}
window_action();
}
var scroll_flug = true;
$("body #container > div#base").scroll(function(){
if(scroll_flug){
scroll_flug = false;
window_action();
setTimeout(function(){
scroll_flug = true;
return scroll_flug;
}, 50);
}
});
$(window).bind("resize", window_resize);
function selectorEscape(val){
return val.replace(/\//g, '\\/');
}
$("html").data("preloaded", 0);
function preload(){
var img = [],
img_arr = $("img.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);
if( 0 >= img_arr_lngth ){
$("html").data("preloaded", 1);
$("div.progress").stop().animate({"width": "100%"},1500,"easeOutQuad",function(){
setTimeout(function(){
$.getScript("http://fes.tobiu.com/2017/js/3d.js?1707063", function(){
});
$("div.progress").addClass("out");
setTimeout(function(){
$("div#preloader").fadeOut(1000, function() {
$(this).remove();
window_resize();
$("html").addClass("start");
});
},1000);
},200);
});
}
};
img[indx].src = $(this).attr('src');
});
}else{
$("html").data("preloaded", 1);
$("div#progress").stop().animate({"width": "100%"},1500,"easeOutQuad",function(){
$.getScript("http://fes.tobiu.com/2017/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");
});
});
}
$("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;
scrollto(val);
}
}
});
});