$('body').imagesLoaded() .always(function (instance) { for (var i = 0; i < $("img[data-src]").length; i++) { $("img[data-src]").eq(i).attr("src", $("img[data-src]").eq(i).data("src")); } }) .progress(function (instance, image) { var result = image.isLoaded ? 'loaded' : 'broken'; var imagesLength = instance.images.length; var imagePrecess = instance.progressedCount; var percent = parseInt(imagePrecess * 100 / imagesLength); if (percent >= 75) { setTimeout(function () { $(".o-splashscreen").addClass("hide"); },300) } }); $(function () { //var newUrl = ""; //window.onhashchange = function (e) { // console.log(e); // newUrl = e.newUrl; //} //if (window.history && window.history.pushState) { // $(window).on('popstate', function (e) { // window.history.pushState('forward', null, '#'); // window.history.forward(1); // console.log(e) // // alert("不可回退"); //如果需在弹框就有它 // $(".o-page-overlay").attr("class", "js-page-transition-animation o-page-overlay init expand");//如查需要跳转页面就用它 // setTimeout(function () { // alert(newUrl) // window.location.href = newUrl; // }, 1000) // }); //} //window.history.pushState('forward', null, '#'); //window.history.forward(1); //window.addEventListener("popstate", function (e) { // $(".o-page-overlay").attr("class", "js-page-transition-animation o-page-overlay init expand");//根据自己的需求实现自己的功能 // console.log(e); //}, false); var e = $("header"); function fixheader() { var t = $(this).scrollTop(); if (1 < e.offset().top && e.not(".fixed-top-ex")) { e.addClass("fixed-top-ex"); } else if (e.hasClass("fixed-top-ex") && 1 >= e.offset().top) { e.removeClass("fixed-top-ex"); } } $(window).on("load scroll", function () { window.requestAnimationFrame(fixheader); }); }); $(".select-language").click(function () { $(".other_url").slideToggle(200); $(".l-arrow").toggleClass("active"); }) $(".jumpTo").click(function (e) { //var img = new Image(); //img.src = $(this).data("img"); var url = $(this).attr("href"); $(".o-page-overlay").attr("class", "js-page-transition-animation o-page-overlay init expand"); stopDefault(e); setTimeout(function () { window.location.href = url; }, 1000) //img.onload = function () { // console.log(2) // setTimeout(function () { // window.location.href = url; // }, 1000) //} }) function stopDefault(e) { if (e && e.preventDefault) e.preventDefault(); else window.event.returnValue = false; //兼容IE } if (!Date.now) Date.now = function () { return new Date().getTime(); }; (function () { 'use strict'; var vendors = ['webkit', 'moz']; for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { var vp = vendors[i]; window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']); } if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy || !window.requestAnimationFrame || !window.cancelAnimationFrame) { var lastTime = 0; window.requestAnimationFrame = function (callback) { var now = Date.now(); var nextTime = Math.max(lastTime + 16, now); return setTimeout(function () {callback(lastTime = nextTime); }, nextTime - now); }; window.cancelAnimationFrame = clearTimeout; } }()); var userAgentInfo = navigator.userAgent; if (userAgentInfo.indexOf("Android") > 0 || userAgentInfo.indexOf("iPhone") > 0 || userAgentInfo.indexOf("SymbianOS") > 0 || userAgentInfo.indexOf("Windows Phone") > 0 || userAgentInfo.indexOf("iPod") > 0 || userAgentInfo.indexOf("iPad") > 0) { window.location.href = "http://wuyistar-tea.com/Mobile/Home/Index"; } else { } function b() { t = parseInt(x.css('top')); y.css('top', '19px'); x.animate({ top: t - 19 + 'px' }, 'slow'); //19为每个li的高度 if (Math.abs(t) == h - 19) { //19为每个li的高度 y.animate({ top: '0px' }, 'slow'); z = x; x = y; y = z; } setTimeout(b, 3000);//滚动间隔时间 现在是3秒 } $(document).ready(function () { $('.swap').html($('.news_li').html()); x = $('.news_li'); y = $('.swap'); h = $('.news_li li').length * 19; //19为每个li的高度 setTimeout(b, 3000);//滚动间隔时间 现在是3秒 })