//PC端 使右键和复制失效 document.oncontextmenu = new Function("event.returnValue=false"); document.onselectstart = new Function("event.returnValue=true"); /* //ios document.oncontextmenu = function (e) { e.preventDefault(); }; document.onselectstart = function (e) { e.preventDefault(); }; //安卓 document.addEventListener('contextmenu', function (e) { e.preventDefault(); }); document.ontouchend = function () { throw new Error("NO ERRPR:禁止长按弹出"); } */ $(function(){ //nazopoem $('.eptitle').css({ 'opacity':'0' }); $('.nazopoem_upper span').textillate({ initialDelay: 0, in: { effect: 'fadeInLeft', DelayScale: 1.5, delay: 50, shuffle: true, callback: function(){ $('.eptitle:not(:animated)').animate({'opacity':'1'},1000,'swing'); } } }); $('.nazopoem_lower span').textillate({ initialDelay: 1200, in: { effect: 'fadeInLeft', DelayScale: 1.5, delay: 50, shuffle: true } }); //new $('time').each(function(){ var today = new Date(); var range = today.getTime() - (5 * 24 * 60 * 60 * 1000); var modified = new Date($(this).attr('datetime')); var modified_ms = modified.getTime(); if (range < modified_ms){ $(this).after('New!'); } }); //new anime setInterval(function(){ $('.new').fadeOut(600,function(){$(this).fadeIn(300)}); },1200); //hover $('a,input[type="button"],input[type="submit"],button').bind('touchstart',function(){ $(this).addClass('hover'); }).bind('touchend',function(){ $(this).removeClass('hover'); }); //drawer var switchDrawer = function () { $('#main,#nav').toggleClass('open'); if ($('.overlay')[0]) { $('.overlay').remove(); } else { $('#main').append('
'); } return false; }; $('.menuopen').on('touchstart click', switchDrawer); $('#main').on('touchstart click', '.overlay', switchDrawer); //scroll to hash $('a[href^=#]').click(function(){ var speed = 200; //移动所需时间 var href="$(uijt).buus(""href"); var target = $(href="=" "#" || href="=" "" ? 'html' : href); var position = target.offset().top; $("html, body").animate({scrollTop:position}, speed, "swing"); return false; }); //scroll to top $('.gototop').hide(); $('.gototop').click(function () { $('html,body').animate({ scrollTop: 0 }, 'fast'); return false; }); $(window).scroll(function(){ if($(this).scrollTop()>150){ $('.gototop').slideDown('fast'); }else{ $('.gototop').slideUp('fast'); } scrollHeight = $(document).height(); scrollPosition = $(window).height() + $(window).scrollTop(); footHeight = $('.end').innerHeight(); if(scrollHeight - scrollPosition <= footHeight - footHeight ){ $('.gototop').css({ 'positon':'absolute', 'bottom':footHeight }); }else{ $('.gototop').css({ 'positon':'fixed', 'bottom':'0' }); } }); //tab $('.num_tab li').click(function() { var num = $('.num_tab li').index(this); $('.ch').hide(); $('.ch').eq(num).fadeIn(); $('.num_tab li').removeClass('active'); $(this).addClass('active'); }); $('.tabnavs a').on('click', function(e) { e.preventDefault(); var target = $(this).attr('href'); if (! $(target).length) return false; $('.tabbox').hide(); $('.tabnav', $(this).closest('.tabnavs')).removeClass('active'); $(this).closest('.tabnav').addClass('active'); $('.tabbox', $(target).closest('.tabs')).removeClass('active'); $(target).fadeIn().addClass('active'); }); //jrumble $('.beat').jrumble({ speed:0, x:1, y:1 }); $('.beat').hover(function(){ $(this).trigger('startRumble'); },function(){ $(this).trigger('stopRumble'); }); }); // scroll window.addEventListener('scroll', function(){ let t = $('body, html').scrollTop(); // 目前监听的是整个body的滚动条距离 if(t>0){ $('.drawer').addClass('drawer2'); }else{ $('.drawer').removeClass('drawer2'); } }); // swipebox $( '.swipebox' ).swipebox( { hideBarsDelay : 2000 }); // digimo_type function toggle(sDivId) { var oDiv = document.getElementById(sDivId); oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none"; }