(function () { // $('header').load('/common/header.html'); // $('footer').load('/common/footer.html'); // 闲时自动加载 var cont = 0, lazyNum = $("img.lazy").length; function loadimg(i) { var img = $("img.lazy").eq(i), src = img.attr('data-src'); img.attr('src', src); //超时 var k = setTimeout(function () { console.log('超时') if (i < lazyNum - 1) { i++; loadimg(i) } clearTimeout(k); return false; }, 1000); console.log(i, lazyNum, img) img[0].onload = function () { clearTimeout(k); if (i < lazyNum - 1) { i++; loadimg(i) } } } window.onload = function () { if (lazyNum != 0) { loadimg(cont); } }; (function(){ $(document).on('contextmenu',function(e){ e.preventDefault(); }) })(); (function () { var winkd = $(window).width(); var wingd = $(window).height(); var maxh = wingd - $('header').outerHeight() * 2; var prop = 5760 / 921; //图片比例 var h = winkd * 3 / prop; if (h > maxh) { h = maxh; } $('.home1 .interactive').height(h); })(); (function () { window.addEventListener('hashchange', function (e) { hash() }) hash() function hash() { var hashVal = window.location.hash.replace('#class=', '.'); if (hashVal != '') { var top = $(hashVal).offset().top - $('header').height(); $('html,body').animate({ scrollTop: top }, 1000); var timeout = setTimeout(function () { window.location.hash = ''; clearTimeout(timeout) }, 200) } } })(); var loaded = setTimeout(function () { $('body').addClass('loading'); var i = 0; var time = setInterval(function () { i = i + 10; $('.load-container .text').html(i + '%'); $('.load-container .progress span').css('width', i + '%'); if (i > 90) { clearInterval(time); clearTimeout(loaded); } }, 200); }, 10); var loaded2 = setTimeout(function () { $('body').addClass('loaded'); clearTimeout(loaded2); }, 2400); $(window).scroll(function () { var vh = 100; var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; if (top > vh) { $('body').addClass('scroll') } else { $('body').removeClass('scroll') } }); $('.switch').click(function () { //nav_btn var switchh = $(this).attr('data-switch'); if (switchh == 'nav') { $('.popup').addClass('open').find('.nav').addClass('on'); } if (switchh == 'search-form') { $('.popup').addClass('open').find('.search-form').addClass('on'); } if (switchh == 'fixed-text') { $('.popup').addClass('open').find('.fixed-text').addClass('on'); } }); $('.popup-close,.popup').click(function () { //nav_btn-close $('.popup').removeClass('open'); $('.popup>div,.popup form').removeClass('on'); }); $('.popup').on('mousewheel', function (e) { e.stopPropagation(); e.preventDefault(); }) $('.popup').on('touchmove', function (e) { e.stopPropagation(); e.preventDefault(); }) $('.popup>div,.popup form').on('click', function (e) { e.stopPropagation(); }) $('.fixed-text,.nav-box').on('mousewheel', function (e) { e.stopPropagation(); }) $('.fixed-text,.nav-box').on('touchmove', function (e) { e.stopPropagation(); }) $('.C-case .btn').hover(function () { $(this).parents('.C-case').toggleClass('open'); }); $('.gotop').click(function () { $('html,body').animate({ scrollTop: 0 }, 800) }); $('.nav-box .link>a').click(function () { $(this).parents('.link').siblings('.link').find('.down').slideUp().find('.twoDown').slideUp(); $(this).siblings('.down').slideToggle(); }); $('.nav-box .link .down .tow-link').click(function () { $(this).siblings('.tow-link').find('.twoDown').slideUp(); $(this).find('.twoDown').slideToggle(); }); })(); /** * ============判断WOW存在否===================== */ $(function () { if (typeof (WOW) != 'function') { return false; } var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, live: true }); window.onload = function () { wow.init(); } }); /** * ============判断WOW存在否===================== */ $(function () { if (typeof (Swiper) != 'function') { return false; } new Swiper('.home4 .swiper-container', { navigation: { nextEl: '.home4 .next', prevEl: '.home4 .prev', }, loop: true, slidesPerView: 'auto', spaceBetween: 18, }); // var at4 = ''; function initAt4() { at4 = new Swiper('.at4 .wrap.on .swiper-container', { navigation: { nextEl: '.at4 .wrap.on .next', prevEl: '.at4 .wrap.on .prev', }, autoplay: { delay: 5000, stopOnLastSlide: false, disableOnInteraction: false, }, noSwiping: true, noSwipingClass: 'swiper-slide', centeredSlides: true, // centeredSlidesBounds: true, // loop: true, speed: 800, // slideToClickedSlide: true, breakpoints: { 320: { slidesPerView: '3', spaceBetween: 0, }, 720: { slidesPerView: '5', spaceBetween: 0, }, } }) } initAt4(); $('.at4 .bar').click(function () { var index = $(this).index(); $('.at4 .bar').removeClass('on').eq(index).addClass('on'); $('.at4 .main .wrap').removeClass('on').eq(index).addClass('on'); initAt4(); at4.update(); }); // });