$(function(){ var default_version = 9; var ua = navigator.useragent.tolowercase(); var isie = ua.indexof("msie") > -1; var safariversion; function banner() { var wid=$(window).width(); var htm=$("#img-list").html(); $("#img-list").append(htm); var len=$("#img-list li").length; $("#img-list").width(wid*len); $("#img-list li").width(wid); for(var i=0;i") } var i=0; function move(){ if(i>=len) { i=len/2; $("#img-list").css({left:-wid*len/2+wid}); }else if(i<0) { i=len/2; $("#img-list").css({left:-wid*len/2}); } $("#dot span").eq(i0){ var time=3000; var slide_time=500; var ullen=$(img).find("li").length; var liwidth=$(img).find("li").outerwidth(true); var ulwidth=ullen*liwidth; var htm=$(img).html(); var bowidth=$(box).width(); $(img).append(htm); ullen=$(img).find("li").length; $(img).width(ullen*liwidth); var i=0; function move() { if(i>=ullen-num) { $(img).css({left:-ulwidth+bowidth+liwidth}); i=ullen/2-num; }else if(i<0) { i=ullen/2-1; $(img).css({left:-ulwidth}); } $(img).stop().animate({left:-liwidth*i},slide_time); i++; } move(); var int = setinterval(move, time); $(next).click(function(){ move(); }) $(prev).click(function(){ i-=2; move(); }) $(wrap).hover(function(){ clearinterval(int); },function(){ int = setinterval(move,time); }) } } function swiperone (){ var myswiper = new swiper('#banner',{ pagination: '#dot', loop: true, autoplay:5000, speed:1000, grabcursor: true, paginationclickable: true, nextbutton: '.banner .next', prevbutton: '.banner .prev', }) var myswiper2 = new swiper('#qu-img',{ paginationclickable: true, slidesperview: 4, autoplay:5000, speed:1000, loop: true, nextbutton: '.copy-box .next', prevbutton: '.copy-box .prev', spacebetween: 27, breakpoints: { 992: { slidesperview: 3, spacebetween: 22 }, 640: { slidesperview: 2, spacebetween: 16 }, 400: { slidesperview: 1, spacebetween:8 } } }) $(".copy-box").hover(function(){ myswiper2.stopautoplay(); },function(){ myswiper2.startautoplay(); }) } if (isie) { safariversion = ua.match(/msie ([\d.]+)/)[1]; var sa = parseint(safariversion); if (safariversion <= default_version) { //ie9以下,添加class名调用slide框架 $("#qu-img").addclass("copy-slide"); banner(); scroll(".copy-list",".copy-list ul",".copy-box .prev",".copy-box .next","4",".copy-box"); } else { //ie9以上,调用swiper2 swiperone(); } } else { //非ie swiperone(); } $(".top-search .search-bt").click(function(){ $(this).siblings(".search-txt").stop().fadein(); $(this).siblings(".search-btn").show(); $(this).hide(); }) $(".top-search .search-btn").click(function(){ $(this).siblings(".search-txt").stop().fadeout(); $(this).hide(); $(".top-search .search-bt").show(); }) $(".header .button").click(function(){ $(this).toggleclass("opened"); $(".menu").stop(true,true).slidetoggle(); }) function wid(){ var wid=$(window).width(); if(wid>1000) { $(".menu>li").hover(function(){ $(this).children(".menul").stop().show(); },function(){ $(this).children(".menul").stop().hide(); }) } if($(window).width()>768) { $(".menu").show(); } else { $(".menu").hide(); $(".header .button").removeclass("opened") } } wid(); $(window).resize(function(){ wid(); }) // 首页新闻切换 $(".news-tab li").click(function(){ var index=$(this).index(); $(this).addclass("on").siblings("li").removeclass("on"); $(".news-box").eq(index).addclass("show").siblings("").removeclass("show"); }) // 首页航天公司切换 $(".news-tab li").click(function(){ var index=$(this).index(); $(this).addclass("on").siblings("li").removeclass("on"); $(".news-box").eq(index).addclass("show").siblings("").removeclass("show"); }) $(".abou-tab li").click(function(){ $(this).addclass("on").siblings("li").removeclass("on"); var index=$(this).index(); $(".abou-box").eq(index).addclass("show").siblings("").removeclass("show"); }) $(".npro-tab li").click(function(){ $(this).addclass("on").siblings("li").removeclass("on"); var index=$(this).index(); $(".npro-cbox").eq(index).addclass("show").siblings("").removeclass("show"); }) })