(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"
});
});
})(jQuery);
$(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"});
}
});
});