$(function() { $("div.social > div a.over").off("mouseover").off("mouseout"); $(document).on("mouseover", "#address address a.over", function(){ $(this).parent().css({ "background-image" : "url(http://leofujisawa.com/elements/btn_utility.png?210414)" }); $(this).stop().animate({ "opacity" : 0 }, 10); }); $(document).on("mouseout", "#address address a.over", function(){ $(this).stop().animate({ "opacity" : 1 }, 500, function(){ $(this).parent().css({"background-image" : "none"}); }); }); $(document).on("mouseover", "#address div a.over", function(){ $(this).parent().css({ "background-image" : "url(http://leofujisawa.com/elements/btn_utility.png?210414)" }); $(this).stop().animate({ "opacity" : 0 }, 10); }); $(document).on("mouseout", "#address div a.over", function(){ $(this).stop().animate({ "opacity" : 1 }, 500, function(){ $(this).parent().css({"background-image" : "none"}); }); }); $(document).on("mouseover", "#entry div.social > div a.over", function(){ $(this).parent().css({ "background-image" : "url(http://leofujisawa.com/elements/btn_social_large.png)" }); $(this).stop().animate({ "opacity" : 0 }, 10); }); $(document).on("mouseout", "#entry div.social > div a.over", function(){ $(this).stop().animate({ "opacity" : 1 }, 500, function(){ $(this).parent().css({"background-image" : "none"}); }); }); $(document).on("click", "aside.top_info a.pjax", function(){ var scrollto = $("#container").offset().top - 80; $('html,body').stop().animate({ scrollTop: scrollto }, 1000, "easeOutQuint"); }); LOADMORE_loadmore_flag = false; function LOADMORE_initialize(LOADMORE_index_i){ var LOADMORE_set_index_count_i = LOADMORE_index_i; LOADMORE_thumb_i_max = $("div#index > article > ul > li.thm").length; thmArr = []; LOADMORE_thumb_i = 0; $("div#index > article > ul > li.thm").each(function(){ thmArr.push($(this)); LOADMORE_thumb_i ++; }); LOADMORE_index_thumbs_fade(LOADMORE_set_index_count_i); } y = 0; prev_y = 0; vertical_align = ""; function LOADMORE_index_thumbs_fade(LOADMORE_set_index_count_i) { var i = LOADMORE_set_index_count_i; if( i < LOADMORE_thumb_i ){ thmArr[i].find(".img > *").imagesLoaded(function(){ if( thmArr[i].is(".on") ){ thmArr[i].stop().animate({opacity:"1"},400); var ua = navigator.userAgent; var isIE8 = ua.match(/msie [8.]/i); if( isIE8 ){ thmArr[i].find("figure *[class != 'text_wrapper']").animate({"opacity":1},200); } }else{ thmArr[i].stop().animate({opacity:"0.1"},400); var ua = navigator.userAgent; var isIE8 = ua.match(/msie [8.]/i); if( isIE8 ){ thmArr[i].find("figure *[class != 'text_wrapper']").animate({"opacity":0.1},200); } } setTimeout(function(){ i++; LOADMORE_index_thumbs_fade(i); },100); }); }else{ LOADMORE_loadmore_flag = true; $("li.load_more").fadeIn(300); } } function LOADMORE_loadmore_index( id, index_count_i, index_count_limit, href ){ $("li.load_more > a > div").fadeOut(300).remove(); $.ajax({ url: "http://leofujisawa.com/ajax_index_load.php", data: "id=" + id + "&index_count_i=" + index_count_i + "&index_count_limit=" + index_count_limit + "", success: function(data, dataType){ $("div#index .load_more").remove(); $("div#index > article > ul").append( data ); LOADMORE_initialize(index_count_i); }, complete: function(XMLHttpRequest, textStatus){ }, error: function(XMLHttpRequest, textStatus, errorThrown){ } }); } $(window).bind('load', function() { setTimeout(function(){ LOADMORE_initialize(0); },100); }); $(document).on("click", ".load_more > a", function(){ if( LOADMORE_loadmore_flag == true ){ LOADMORE_loadmore_flag = false; 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( "http://leofujisawa.com/", "" ); LOADMORE_loadmore_index( id, index_count_i, index_count_limit, href ); } return false; }); $(window).scroll(function(){ var window_height = $(window).height(); var scroll_val = $(window).scrollTop(); if( LOADMORE_loadmore_flag == true && $("li.load_more > a > div").length ){ var target = $(".load_more > a"); var margin = 500; var load_more_top = target.offset().top; if( scroll_val > load_more_top - window_height - margin ){ var id = target.attr("data-id"); var index_count_i = target.attr("data-index_count_i"); var index_count_limit = target.attr("data-index_count_limit"); var href = target.attr("href").replace( "http://leofujisawa.com/", "" ); LOADMORE_loadmore_flag = false; LOADMORE_loadmore_index( id, index_count_i, index_count_limit, href ); } } }); function SLIDE_fullscreen_initialize(){ SLIDE_fullscreen_start_flag = "false"; SLIDE_fullscreen_repeat_flag = "true"; SLIDE_fullscreen_repeat_limit = 0; SLIDE_fullscreen_repeat_limit_max = 1000; SLIDE_fullscreen_set_pagewrap_width = 0; SLIDE_fullscreen_create_img_i = 0; SLIDE_fullscreen_preload_i = 0; SLIDE_fullscreen_past_i = -1; SLIDE_fullscreen_timer_id_B = "false"; SLIDE_fullscreen_imgHEIGHT = 0; SLIDE_fullscreen_imgWIDTH = 0; SLIDE_fullscreen_create_img(); $(window).bind("resize", SLIDE_fullscreen_resizeContainer); SLIDE_fullscreen_resizeContainer(); } function SLIDE_fullscreen_control_show( set_interval ){ if( SLIDE_fullscreen_timer_id_B != "false" ){ clearInterval( SLIDE_fullscreen_timer_id_B ); } $("#SLIDE_fullscreen .controller:not(:animated)").animate({ opacity: 1 }, 400, function() { SLIDE_fullscreen_timer_id_B = setInterval( SLIDE_fullscreen_control_hide, set_interval); } ); } function SLIDE_fullscreen_control_hide(){ $("#SLIDE_fullscreen .controller:not(:animated)").animate({ opacity: 0.4 }, 400 ); clearInterval( SLIDE_fullscreen_timer_id_B ); } $("#wrapper").mousemove(function(e){ SLIDE_fullscreen_control_show( 2000 ); }); $(document).on("click", "#SLIDE_fullscreen_thumbs_wrapper a", function(){ SLIDE_fullscreen_create_img_i = $(this).attr("id").replace("SLIDE_fullscreen_", ""); SLIDE_fullscreen_create_img(); }); $(document).on("mouseover", "#SLIDE_fullscreen_thumbs_wrapper a.over", function(){ $(this).stop().animate({ "opacity" : 0.5 }, 10); }); $(document).on("mouseout", "#SLIDE_fullscreen_thumbs_wrapper a.over", function(){ $(this).stop().animate({ "opacity" : 1 }, 500); }); function SLIDE_fullscreen_create_img(){ if( SLIDE_fullscreen_past_i != SLIDE_fullscreen_create_img_i ){ $("#SLIDE_fullscreen_thumbs_wrapper a").css({"color": "#333"}).css({"cursor": "pointer"}).addClass("over"); $("#SLIDE_fullscreen_thumbs_wrapper a#SLIDE_fullscreen_" + SLIDE_fullscreen_create_img_i).css({"color": "#CCC"}).css({"cursor": "default"}).removeClass("over"); var imgURL = SLIDE_fullscreen_media_array[ SLIDE_fullscreen_create_img_i ][0]; var past_set_img_div = "img_div_" + SLIDE_fullscreen_past_i; var past_target = $("div#" + past_set_img_div); SLIDE_fullscreen_past_i = SLIDE_fullscreen_create_img_i; SLIDE_fullscreen_set_img_div = "img_div_" + SLIDE_fullscreen_create_img_i; $("#SLIDE_fullscreen #main").append("
"); SLIDE_fullscreen_resizeContainer(); var target = $("div#" + SLIDE_fullscreen_set_img_div); target.find("img").load(function () { past_target.animate({"opacity": 0}, 2000, "swing", function() { $(this).remove(); } ); SLIDE_fullscreen_imgHEIGHT = eval(SLIDE_fullscreen_media_array[ SLIDE_fullscreen_create_img_i ][4]); SLIDE_fullscreen_imgWIDTH = eval(SLIDE_fullscreen_media_array[ SLIDE_fullscreen_create_img_i ][5]); SLIDE_fullscreen_resizeContainer(); target.animate({"opacity": 1}, 2000, "swing"); SLIDE_fullscreen_preload_image(); SLIDE_fullscreen_scrCtr(); }); target.find("img").attr("src", imgURL); } } function SLIDE_fullscreen_preload_image(){ if( SLIDE_fullscreen_preload_i ){ $("#SLIDE_fullscreen img#pre_" + SLIDE_fullscreen_preload_i).remove(); } SLIDE_fullscreen_preload_i = eval(SLIDE_fullscreen_create_img_i)+1; if( SLIDE_fullscreen_preload_i < SLIDE_fullscreen_media_max_num ){ var next_imgURL = SLIDE_fullscreen_media_array[ SLIDE_fullscreen_preload_i ][0]; $("#SLIDE_fullscreen #main").append(""); var next_target = $("#SLIDE_fullscreen img#pre_" + SLIDE_fullscreen_preload_i ); next_target.attr("src", next_imgURL); } } function SLIDE_fullscreen_resizeContainer(e) { var window_height = $(window).height(); var window_width = $(window).width(); var navi_height = $("#header").height(); var margin_top = navi_height; var margin_bottom = 80; var margin_width = 0; if( window_width <= 500 ){ margin_top = 50; margin_bottom = 0; margin_width = 0; }else if( window_width <= 740 ){ margin_top = navi_height; margin_bottom = 80; margin_width = 0; } var frame_height = window_height - margin_top - margin_bottom; var img_height = frame_height; var img_width = window_width - margin_width*2; $("div#SLIDE_fullscreen #frame").css("height", frame_height); $("div#SLIDE_fullscreen #frame").css("width", window_width); $("div#SLIDE_fullscreen #frame").css("margin-top", margin_top); $("#SLIDE_fullscreen .controller").css("top", (frame_height - $("#SLIDE_fullscreen .controller").height())/2 + margin_top); if( SLIDE_fullscreen_imgWIDTH != 0 ){ if( Math.round(SLIDE_fullscreen_imgWIDTH / img_width * 100) <= Math.round(SLIDE_fullscreen_imgHEIGHT / img_height * 100) ){ var set_height = img_height; var set_width = SLIDE_fullscreen_imgWIDTH*Math.round(set_height/SLIDE_fullscreen_imgHEIGHT*100)/100; }else{ var set_width = img_width; var set_height = SLIDE_fullscreen_imgHEIGHT*Math.round(set_width/SLIDE_fullscreen_imgWIDTH*100)/100; } var set_margin_top = (frame_height - set_height)/2; var set_margin_left = (window_width - set_width)/2; $("div#SLIDE_fullscreen div#" + SLIDE_fullscreen_set_img_div + " img" ).css("height", set_height); $("div#SLIDE_fullscreen div#" + SLIDE_fullscreen_set_img_div + " img" ).css("width", set_width); $("div#SLIDE_fullscreen div#" + SLIDE_fullscreen_set_img_div + " img" ).css("margin-top", set_margin_top); $("div#SLIDE_fullscreen div#" + SLIDE_fullscreen_set_img_div + " img" ).css("margin-left", set_margin_left); } } $("#SLIDE_fullscreen div.arrow_box_photo_right").click(function(){ SLIDE_fullscreen_create_img_i ++; if( SLIDE_fullscreen_create_img_i == SLIDE_fullscreen_media_max_num){ SLIDE_fullscreen_create_img_i = 0; } SLIDE_fullscreen_create_img(); }) $("#SLIDE_fullscreen div.arrow_box_photo_left").click(function(){ if( SLIDE_fullscreen_create_img_i == 0){ SLIDE_fullscreen_create_img_i = SLIDE_fullscreen_media_max_num; } SLIDE_fullscreen_create_img_i --; SLIDE_fullscreen_create_img(); }) $("#SLIDE_fullscreen .arrow_box_photo_right, #SLIDE_fullscreen .arrow_box_photo_left").mouseover(function(){ $(this).stop().animate({ opacity : 1 },200) } ) $("#SLIDE_fullscreen .arrow_box_photo_right, #SLIDE_fullscreen .arrow_box_photo_left").mouseout(function(){ $(this).stop().animate({ opacity : 0.6 },400) } ) $("#SLIDE_fullscreen .arrow_box_photo_right, #SLIDE_fullscreen .arrow_box_photo_left").animate({ opacity : 0.6 },100) function SLIDE_fullscreen_scrCtr(){ if( SLIDE_fullscreen_start_flag == "false" ){ SLIDE_fullscreen_start_flag = "true"; }else{ clearTimeout( SLIDE_fullscreen_Repeater ); } if( SLIDE_fullscreen_repeat_flag == "true" ){ $("#SLIDE_fullscreen div.play_box").css("display", "none"); $("#SLIDE_fullscreen div.stop_box").css("display", "block"); SLIDE_fullscreen_Repeater = setTimeout( function(){ SLIDE_fullscreen_slidePlay(); } , 5000); }else{ $("#SLIDE_fullscreen div.play_box").css("display", "block"); $("#SLIDE_fullscreen div.stop_box").css("display", "none"); } } function SLIDE_fullscreen_slidePlay(){ SLIDE_fullscreen_create_img_i ++; if( SLIDE_fullscreen_create_img_i == SLIDE_fullscreen_media_max_num){ SLIDE_fullscreen_create_img_i = 0; SLIDE_fullscreen_repeat_limit ++; if( SLIDE_fullscreen_repeat_limit > SLIDE_fullscreen_repeat_limit_max ){ SLIDE_fullscreen_repeat_limit = 0; SLIDE_fullscreen_repeat_flag = "false"; } } SLIDE_fullscreen_create_img(); } SLIDE_fullscreen_media_array = [['http://s3.media-nisor.site.s3.amazonaws.com/image/leo_entry_2014_0130_061929_3030.jpg', 'http://s3.media-nisor.site.s3.amazonaws.com/image_thumbs/leo_entry_2014_0130_061929_3030.jpg', '', '', 1000, 1000, '' ],['http://s3.media-nisor.site.s3.amazonaws.com/image/leo_entry_2014_0130_061932_0443.jpg', 'http://s3.media-nisor.site.s3.amazonaws.com/image_thumbs/leo_entry_2014_0130_061932_0443.jpg', '', '', 1000, 1000, '' ],['http://s3.media-nisor.site.s3.amazonaws.com/image/leo_entry_2014_0130_061935_6300.jpg', 'http://s3.media-nisor.site.s3.amazonaws.com/image_thumbs/leo_entry_2014_0130_061935_6300.jpg', '', '', 664, 1000, '' ],['http://s3.media-nisor.site.s3.amazonaws.com/image/leo_entry_2014_0130_061939_6261.jpg', 'http://s3.media-nisor.site.s3.amazonaws.com/image_thumbs/leo_entry_2014_0130_061939_6261.jpg', '', '', 478, 1000, '' ],['http://s3.media-nisor.site.s3.amazonaws.com/image/leo_entry_2014_0130_061945_5149.jpg', 'http://s3.media-nisor.site.s3.amazonaws.com/image_thumbs/leo_entry_2014_0130_061945_5149.jpg', '', '', 1000, 1000, '' ],['http://s3.media-nisor.site.s3.amazonaws.com/image/leo_entry_2014_0130_061949_7129.jpg', 'http://s3.media-nisor.site.s3.amazonaws.com/image_thumbs/leo_entry_2014_0130_061949_7129.jpg', '', '', 527, 1000, '' ]]; SLIDE_fullscreen_media_max_num = 6; var wrapper = $("
").attr("id","SLIDE_fullscreen_thumbs_wrapper"); var a; for(var i=0;i < SLIDE_fullscreen_media_max_num; i++){ a = $("").attr("id","SLIDE_fullscreen_" + i).text(i+1).addClass("over"); wrapper.append(a); } $("#container").prepend(wrapper); SLIDE_fullscreen_initialize(); });