/* ========== ::: 画像のマウスオーバー ::: ========== */ function smartRollover() { if(document.getElementsByTagName) { var images = document.getElementsByTagName("img"); for(var i=0; i < images.length; i++) { if(images[i].getAttribute("src").match("_link.")) { images[i].onmouseover = function() { this.setAttribute("src", this.getAttribute("src").replace("_link.", "_on.")); } images[i].onmouseout = function() { this.setAttribute("src", this.getAttribute("src").replace("_on.", "_link.")); } } } } } if(window.addEventListener) { window.addEventListener("load", smartRollover, false); } else if(window.attachEvent) { window.attachEvent("onload", smartRollover); } /* ========== ::: スムーズスクロール ::: ========== */ // Easingの追加 jQuery.easing.quart = function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }; jQuery(document).ready(function(){ // // の場合、スクロール処理を追加 // jQuery('a[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var $target = jQuery(this.hash); $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']'); if ($target.length) { var targetOffset = $target.offset().top; jQuery('html,body').animate({ scrollTop: targetOffset }, 1200, 'quart'); return false; } } }); }); //pagetop $(document).ready(function() { var pagetop = $('.pagetop'); $(window).scroll(function () { if ($(this).scrollTop() > 400) { pagetop.fadeIn(); } else { pagetop.fadeOut(); } }); pagetop.click(function () { $('body, html').animate({ scrollTop: 0 }, 400); return false; }); });