$(document).ready(function(){ // $("#topBtn").hide(); /* $(window).bind("scroll", function(){ var scrollHeight = $(document).height(), scrollPosition = $(window).height() + $(window).scrollTop(); if ( (scrollHeight - scrollPosition) / scrollHeight <= 0.15){ $("#topBtn").fadeIn("100"); } else { $("#topBtn").fadeOut("100"); } }); $('#topBtn').click(function(){ $('body,html').animate({ scrollTop: 0 }, 500); return false; }); */ }); /* $(function() { var topBtn = $('#topBtn'); topBtn.hide(); $(window).scroll(function () { if ($(this).scrollTop() > 12900) { topBtn.fadeIn(); } if ($(this).scrollTop() > 12850) { topBtn.fadeIn(); } else { topBtn.fadeOut(); } }); topBtn.click(function () { $('body, html').animate({scrollTop:0}, 500, 'swing'); return false; }); }); */ /* var $ua = navigator.userAgent; $(function(){ if($ua.indexOf('iPhone') > 0 || $ua.indexOf('iPad') > 0 || $ua.indexOf('iPod') > 0 || $ua.indexOf('android') > 0 || $ua.indexOf('BlackBerry') > 0 || $ua.indexOf('windows Phone') > 0 || $ua.indexOf('NOKIA') > 0 || /Mobile.*Firefox/.test($ua)){ console.log("sp"); var showTop = 12800, topBtn = $('#topBtn'); topBtn.on('click',function(){ $('html,body').animate({scrollTop:'0'},500); }); $(window).on('load scroll resize',function(){ if($(window).scrollTop() >= showTop){ topBtn.fadeIn(700); } else if($(window).scrollTop() < showTop){ topBtn.fadeOut(200); } }); }else{ console.log("pc"); $(function(){ var showTop = 1280, $(window).on('scroll', function(){ if($(window).scrollTop() >= showTop){ topBtn.fadeIn(700); } else if($(window).scrollTop() < showTop){ topBtn.fadeOut(200); } }); }); } }); */ /* $(function() { var $ua = navigator.userAgent; $(function(){ if($ua.indexOf('iPhone') > 0 || $ua.indexOf('iPad') > 0 || $ua.indexOf('iPod') > 0 || $ua.indexOf('android') > 0 || $ua.indexOf('BlackBerry') > 0 || $ua.indexOf('windows Phone') > 0 || $ua.indexOf('NOKIA') > 0 || /Mobile.*Firefox/.test($ua)){ if ($(this).scrollTop() > 285) { topBtn.fadeIn(); } else { topBtn.fadeOut(); } } else { // $('.pcUser').show(); } }); }); */ $(function(){ var scroll_speed= "slow"; $(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"}); } }); $("a.to_top").click(function(){ $("html,body").animate({ scrollTop:0 },scroll_speed); return false; }); });