/* Safari 『強制』禁止縮放 ==================================================*/ document.documentElement.addEventListener('touchstart', function (e) { if (e.touches.length > 1) e.preventDefault(); }, false); var lastTouchEnd = 0; document.documentElement.addEventListener('touchend', function (e) { var now = (new Date()).getTime(); if (now - lastTouchEnd <= 300) e.preventDefault(); lastTouchEnd = now; }, false); var script = function(){ var $body = $('html,body'); var winH = $(window).height(); var winW = $(window).width(); var $win = $(window); var scrollBottom = $(window).scrollTop() + $(window).height(); var conH = $('.container').height(); var headerH = $('header').height(); // console.log('location.href: '+location.href); // console.log('location.protocol: '+location.protocol); // console.log('location.hostname: '+location.hostname); // console.log('location.host: '+location.host); // console.log('location.pathname: '+location.pathname); // var hash = location.hash; // if( $('#promo').length ){ // var promoPos = $('#promo').offset().top; // } // function promoscroll() { // if( hash != '' && hash == '#promo' ){ // TweenMax.to('body,html', .8, { scrollTop: promoPos , ease: Quart.easeOut }); // } // } // promoscroll(); /* lightbox ------------------------------------------------------------*/ // // var lightbox = function(){ // var $lb = $('.lb'), // $lbbox = $('.lbbox'); // // var _vdUrl = 'https://www.youtube.com/embed/' // var lb_data, // lbname; // // var lbname = 'reason'; // TweenMax.set($('.lb'),{opacity:0 , zIndex:-1}); // var lbOpen = function(lb_data){ // var lbAni = new TimelineMax(); // lbAni.to($('.lb[data-lb="'+lb_data+'"]') , .3 ,{css:{zIndex:9999}} , '-=.3') // .to($('.lb[data-lb="'+lb_data+'"]') , .3 ,{opacity:1 ,ease:Linear.easeNone}); // if($('.restart').length){ // $('.restart').click(lbClose); // } // $body.css({ // 'overflow':'hidden', // 'position':'fixed' // }) // } // var lbClose = function(lb_data2){ // var lbCloseAni = new TimelineMax(); // lbCloseAni.to($('.lb') , .3 ,{opacity:0 ,ease:Linear.easeNone}) // .to($('.lb') , .3 ,{css:{zIndex:-1}}); // $body.css({ // 'overflow':'', // 'position':'' // }) // } // $('.libtn').click(function(){ // var lbname = $(this).data('lb'); // lbOpen(lbname); // return false; // }); // $('.lb .btn_x').click(function () { // lbClose(); // }); /* resize ------------------------------------------------------------*/ var _resize = function() { winW = $win.width(); winH = $win.height(); docH = $(document).height(); _scroll = $(window).scrollTop(); scrollBottom = $(window).scrollTop() + $(window).height(); headerH = $('header').height(); // promoPos = $('#promo').offset().top; // promoscroll(); // navde(); } _resize(); $win.resize(function() { _resize(); }); var windowHeight = $(window).height(); // Resize Event $(window).resize(function() { // Check window width has actually changed and it's not just iOS triggering a resize event on scroll if ($(window).width() != windowHeight) { // Update the window width for next time windowHeight = $(window).width(); // Do stuff here _resize(); } }); }; $(function () { // $('.plus').on('click', function(){ // $("body").css('overflow-y',"hidden"); // $(".lightbox").addClass('_show'); // }) // $('.lb-close').on('click', function(){ // $(".lightbox").removeClass('_show'); // $("body").css('overflow-y',"scroll"); // }) $('.gotop').on('click', function(){ $('html, body').stop().animate({ scrollTop: true }, 600); }) var imagesLoaded = loading(); imagesLoaded.loadfunc(); imagesLoaded.callback = function(){ script(); }; });