(function($){ $(document).ready(function(){ //setting //on off rollover,advance load var src_on = "_on.", src_off = "_off.", //to page,to top offset = 0, scroll_speed = "slow", //opacty rollover on_speed = 0, off_speed = "fast", transp = 0.7, //pngfix exclusion png_exc = "exc"; //hover $(".hover").hover( function(){ $(this).stop(true, true).fadeTo(300,0.5); }, function(){ $(this).stop(true, true).fadeTo(300,1.0); }); //to page $("a.to_page").click(function(){ var href = $(this).attr("href"); href = href.split("#"); if($("#" + href[1]).size() > 0 || href[0] == ""){ var p = $("#" + href[1]).offset().top - offset; $("html,body").animate({ scrollTop:p },scroll_speed); return false; } }); //to top $("a.to_top").click(function(){ $("html,body").animate({ scrollTop:0 },scroll_speed); return false; }); //bg $('.mainboxwrap').bgSwitcher({ images: ['./images/main_01.png', './images/main_02.png', './images/main_03.png'], interval: 4000, loop: true, shuffle: false, effect: "fade", duration: 700, easing: "swing" }); }); $(window).load(function(){ //height_init height_init(".tile01",4); height_init(".tile01 .pt01",4); height_init(".tile02",4); height_init(".tile03",4); height_init(".tile04",4); }); })(jQuery); //height initialization function height_init(cls,num){ num = num || 1; var temp = new Array(); var i = 0; jQuery(cls).each(function(){ var t = jQuery(this).height().toString(); temp[i] = t; i++; }); var h = new Array(); var i = num; jQuery.each(temp,function(key,val){ if(num > 1){ var j = Math.floor((i / num) - 1); if(h[j] == null || h[j] < Number(val)){ h[j] = Number(val); } }else{ if(h[0] == null || h[0] < Number(val)){ h[0] = Number(val); } } i++; }); var i = num; jQuery(cls).each(function(){ if(num > 1){ var j = Math.floor((i / num) - 1); jQuery(this).height(h[j]); }else{ jQuery(this).height(h[0]); } i++; }); } $(function(){ $(window).bind("scroll", function() { if ($(this).scrollTop() > 150) { $(".pagetop").fadeIn(); } else { $(".pagetop").fadeOut(); } // ドキュメントの高さ scrollHeight = $(document).height(); // ウィンドウの高さ+スクロールした高さ→ 現在のトップからの位置 scrollPosition = $(window).height() + $(window).scrollTop(); // フッターの高さ footHeight = $("#footerwrap").height(); // スクロール位置がフッターまで来たら if ( scrollHeight - scrollPosition <= footHeight ) { // ページトップリンクをフッターに固定 $(".pagetop a").css({"position":"fixed","bottom": "30px"}); } else { // ページトップリンクを右下に固定 $(".pagetop a").css({"position":"fixed","bottom": "30px"}); } }); });