/* * @author: administrator * @date: 2017-02-20 15:25:43 * @last modified by: administrator * @last modified time: 2017-03-01 10:27:26 */ 'use strict'; $(function(){ $('.navbtn').click(function(event) { $('.navm').slidedown(500); }); $('.navm b').click(function(event) { $('.navm').slideup(500); }); /*var a=true; $('.navbtn').click(function(event) { if(a==true){ $(this).children('img').attr("src","images/list_m1.png"); $('.navm').slidedown(500); a=false; }else{ $(this).children('img').attr("src","images/list_m.png"); $('.navm').slideup(500); a=true; } });*/ var a=true; $('.navm h2').click(function() { if(a==true){ $(this).next('.hidebox').show(); a=false; }else{ $(this).next('.hidebox').hide(); a=true; } }); /*$(".li01").hover(function(){ $(this).children('.secondnav').stop().slidedown(300); },function(){ $(this).children('.secondnav').stop().slideup(300); });*/ /*$(".biga").hover(function(){ $(this).next('.secondnav').animate({ height:'toggle'}); });*/ var myswiper = new swiper ('.banner .swiper-container', { loop: true, autoplay: 4000, pagination: '.banner .swiper-pagination', oninit: function(swiper){ swiperanimatecache(swiper); swiperanimate(swiper); }, onslidechangeend: function(swiper){ swiperanimate(swiper); } }) var swiper2 = new swiper('.conbox .swiper-container', { pagination: '.conbox .swiper-pagination', nextbutton: '.conbox .swiper-button-next', prevbutton: '.conbox .swiper-button-prev', slidesperview: 1, paginationclickable: true, spacebetween: 30, loop: true }); var swiper7 = new swiper('.joinimg', { paginationclickable: true, slidesperview:"auto", effect:"coverflow", centeredslides:!0, spacebetween:0, prevbutton:'.join-prev', nextbutton:'.join-next', loop : true, coverflow:{rotate:0,stretch:0,depth:400,modifier:1,slideshadows:!0}, autoplay: 4000, speed:1400, autoplaydisableoninteraction: false, oninit: function(swiper){ $(".swiper-slide-active").css({"z-index":2}) }, onclick: function(swiper){ $(".swiper-slide-active").css({"z-index":2}) }, onautoplay: function(swiper){ $(".swiper-slide-active").css({"z-index":2}) } }); var b=true; $('.tit').click(function() { if(b==true){ $(this).addclass('bgcheng').siblings('.rec-zhed dd').slidedown(500); b=false; }else{ $(this).removeclass('bgcheng').siblings('.rec-zhed dd').slideup(500); b=true; } }); /**/ (function(){ function g(s){ return document.getelementbyid(s); } function getstyle(obj, attr){ if(obj.currentstyle){ return obj.currentstyle[attr]; }else{ return getcomputedstyle(obj, false)[attr]; } } function animate(obj, json){ if(obj.timer){ clearinterval(obj.timer); } obj.timer = setinterval(function(){ for(var attr in json){ var icur = parseint(getstyle(obj, attr)); icur = icur ? icur : 0; var ispeed = (json[attr] - icur) / 5; ispeed = ispeed > 0 ? math.ceil(ispeed) : math.floor(ispeed); obj.style[attr] = icur + ispeed + 'px'; if(icur == json[attr]){ clearinterval(obj.timer); } } }, 30); } var opic = g("picbox"); var olist = g("listbox"); var oprev = g("prev"); var onext = g("next"); var oprevtop = g("prevtop"); var onexttop = g("nexttop"); var opicli = opic.getelementsbytagname("li"); var olistli = olist.getelementsbytagname("li"); var len1 = opicli.length; var len2 = olistli.length; var opicul = opic.getelementsbytagname("ul")[0]; var olistul = olist.getelementsbytagname("ul")[0]; var w1 = opicli[0].offsetwidth; var w2 = olistli[0].offsetwidth; opicul.style.width = w1 * len1 + "px"; olistul.style.width = w2 * len2 + "px"; var index = 0; var num = 5; var num2 = math.ceil(num / 2); function change(){ animate(opicul, {left: - index * w1}); if(index < num2){ animate(olistul, {left: 0}); }else if(index + num2 <= len2){ animate(olistul, {left: - (index - num2 + 1) * w2}); }else{ animate(olistul, {left: - (len2 - num) * w2}); } for (var i = 0; i < len2; i++) { olistli[i].classname = ""; if(i == index){ olistli[i].classname = "on"; } } } onexttop.onclick = onext.onclick = function(){ index ++; index = index == len2 ? 0 : index; change(); } oprevtop.onclick = oprev.onclick = function(){ index --; index = index == -1 ? len2 -1 : index; change(); } for (var i = 0; i < len2; i++) { olistli[i].index = i; olistli[i].onclick = function(){ index = this.index; change(); } } })() })