$(function(){ $(window).scroll(function (){ $('.fadein').each(function(){ var elemPos = $(this).offset().top; var scroll = $(window).scrollTop(); var windowHeight = $(window).height(); if (scroll > elemPos - windowHeight + 100){ $(this).addClass('scrollin'); } }); }); }); $(window).load(function(){ // assign the slider to a variable var slider = $('#slider2').bxSlider({ mode: 'horizontal', auto: true, responsive: true, pause: 4000, speed: 1000, prevText: '', nextText: '', pager: true, //easing: 'easeOutBounce', pagerCustom: '.bx-pager', onSlideAfter: function () { slider.startAuto();} }); }); $(document).ready(function(){ $('#slider').bxSlider({ mode: 'fade', auto: true, speed: 1000, pause: 3000, //スライドスピード infiniteLoop: true, hideControlOnEnd: true, startSlide: 0, pager: true, prevText: '', nextText: '', touchEnabled: true }); }); $(function(){ var $setElem = $('.switch'), pcName = '_pc', spName = '_sp', replaceWidth = 641; $setElem.each(function(){ var $this = $(this); function imgSize(){ if(window.innerWidth > replaceWidth) { $this.attr('src',$this.attr('src').replace(spName,pcName)).css({visibility:'visible'}); } else { $this.attr('src',$this.attr('src').replace(pcName,spName)).css({visibility:'visible'}); } } $(window).resize(function(){imgSize();}); imgSize(); }); }); $(function() { var topBtn = $('#page-top'); topBtn.hide(); $(window).scroll(function () { if ($(this).scrollTop() > 100) { topBtn.fadeIn(); } else { topBtn.fadeOut(); } }); topBtn.click(function () { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); }); function smartRollover() { if(document.getElementsByTagName) { var images = document.getElementsByTagName("img"); for(var i=0; i < images.length; i++) { if(images[i].getAttribute("src").match("_off.")) { images[i].onmouseover = function() { this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on.")); } images[i].onmouseout = function() { this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off.")); } } } } } if(window.addEventListener) { window.addEventListener("load", smartRollover, false); } else if(window.attachEvent) { window.attachEvent("onload", smartRollover); }