function mswMove(boxID, btn_left, btn_right, btnBox, Car, direction, way, moveLengh, speed, Interval, number) { var _ID = $("#" + boxID + ""); var _btn_left = $("#" + btn_left + ""); var _btn_right = $("#" + btn_right + ""); var _btnBox = $("#" + btnBox + ""); var jsq = 0/*底部按钮切换计数器*/ var timer; /*轮播时间设置*/ var cj; /*底部按钮数值差值*/ var no_way = 0; var no_wayGet = 0; var ID_liLen, ID_liheight, cbtmBtn; ID_liLen = _ID.find("li").length; ID_liheight = _ID.find("li").innerHeight(); /*判断滚动方向:上下左右*/ if (direction == "left" || direction == "right") { _ID.find("ul").width(ID_liLen * moveLengh); } else if (direction == "top" || direction == "bottom") { _ID.find("ul").height(ID_liLen * moveLengh); _btnBox.hide() } _btnBox.empty(); for (i = 0; i < ID_liLen; i++) { _btnBox.append(""); }; _btnBox.find("span").eq(0).addClass("cur"); if (way == false) { _btn_left.hide(); _btn_right.hide(); _btnBox.hide(); } /*自动轮播*/ function Carousel() { if (way == false) { /*非间断式滚动*/ no_way++; if (direction == "left") { _ID.find("ul").css({ "left": -no_way } ); no_wayGet = parseInt(_ID.find("ul").css("left")); /*获取ul的left值*/ if (no_wayGet == -moveLengh) { no_way = 0 _ID.find("li:first").insertAfter(_ID.find("li:last")); _ID.find("ul").css({ "left": 0 } ); } } /*向左滚动*/ if (direction == "right") { no_wayGet = parseInt(_ID.find("ul").css("left")); /*获取ul的right值*/ if (no_wayGet == 0) { no_way = -moveLengh _ID.find("li:last").insertBefore(_ID.find("li:first")); _ID.find("ul").css({ "left": 0 } ); } _ID.find("ul").css({ "left": no_way } ); } /*向右滚动*/ if (direction == "top") { _ID.find("ul").css({ "top": -no_way } ); no_wayGet = parseInt(_ID.find("ul").css("top")); /*获取ul的left值*/ if (no_wayGet == -moveLengh) { no_way = 0 _ID.find("li:first").insertAfter(_ID.find("li:last")); _ID.find("ul").css({ "top": 0 } ); } } /*向上滚动*/ if (direction == "bottom") { no_wayGet = parseInt(_ID.find("ul").css("top")); /*获取ul的right值*/ if (no_wayGet == 0) { no_way = -moveLengh _ID.find("li:last").insertBefore(_ID.find("li:first")); _ID.find("ul").css({ "top": 0 } ); } _ID.find("ul").css({ "top": no_way } ); } /*向下滚动*/ } else if (way == true) { /*间断式滚动*/ if (direction == "left") { _ID.find("ul").animate({ left: -moveLengh } , speed, function () { _ID.find("li:first").insertAfter(_ID.find("li:last")); _ID.find("ul").css({ "left": 0 } ); } ); if (jsq < ID_liLen - 1) { jsq++; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); } else { jsq = 0; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); } } /*向左滚动*/ if (direction == "right") { _ID.find("li:last").insertBefore(_ID.find("li:first")); _ID.find("ul").css({ "left": -moveLengh } ); _ID.find("ul").stop().animate({ left: 0 } , speed); if (jsq > 0) { jsq--; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); } else { jsq = ID_liLen - 1; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); } } /*向右滚动*/ if (direction == "top") { _ID.find("ul").animate({ top: -moveLengh } , speed, function () { _ID.find("li:first").insertAfter(_ID.find("li:last")); _ID.find("ul").css({ "top": 0 } ); } ); } /*向上滚动*/ if (direction == "bottom") { _ID.find("li:last").insertBefore(_ID.find("li:first")); _ID.find("ul").css({ "top": -moveLengh } ); _ID.find("ul").stop().animate({ top: 0 } , speed); } /*向下滚动*/ } /*判断滚动方式*/ } /*end Carousel*/ /*是否需要自动轮播*/ if (Car == true) { /*判断是否需要轮播,滚动总数小余或者等于窗口显示数目*/ if (ID_liLen > number) { timer = setInterval(Carousel, Interval); } else { clearInterval(timer); _btn_left.hide(); _btn_right.hide(); _btnBox.hide(); } } else { clearInterval(timer); } _ID.find("li").hover(function () { clearInterval(timer); } , function () { if (Car == true) { if (ID_liLen > number) { timer = setInterval(Carousel, Interval); } else { clearInterval(timer); _btn_left.hide(); _btn_right.hide(); _btnBox.hide(); } } else { clearInterval(timer); } } ); /*click右边按钮*/ _btn_right.hover(function () { clearInterval(timer); } , function () { if (Car == true) { if (ID_liLen > number) { timer = setInterval(Carousel, Interval); } else { clearInterval(timer); _btn_left.hide(); _btn_right.hide(); _btnBox.hide(); } } else { clearInterval(timer); } } ).click(function () { if (direction == "left" || direction == "right") { _ID.find("ul").animate({ left: -moveLengh } , speed, function () { _ID.find("li:first").insertAfter(_ID.find("li:last")); _ID.find("ul").css({ "left": 0 } ); } ); } if (direction == "top" || direction == "bottom") { _ID.find("ul").animate({ top: -moveLengh } , speed, function () { _ID.find("li:first").insertAfter(_ID.find("li:last")); _ID.find("ul").css({ "top": 0 } ); } ); } if (jsq < ID_liLen - 1) { jsq++; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); } else { jsq = 0; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); }; } ); /*click左边按钮*/ _btn_left.hover(function () { clearInterval(timer); } , function () { if (Car == true) { if (ID_liLen > number) { timer = setInterval(Carousel, Interval); } else { clearInterval(timer); _btn_left.hide(); _btn_right.hide(); _btnBox.hide(); } } else { clearInterval(timer); } } ).click(function () { if (direction == "left" || direction == "right") { _ID.find("li:last").insertBefore(_ID.find("li:first")); _ID.find("ul").css({ "left": -moveLengh } ); _ID.find("ul").stop().animate({ left: 0 } , speed); } if (direction == "top" || direction == "bottom") { _ID.find("li:last").insertBefore(_ID.find("li:first")); _ID.find("ul").css({ "top": -moveLengh } ); _ID.find("ul").stop().animate({ top: 0 } , speed); } if (jsq > 0) { jsq--; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); } else { jsq = ID_liLen - 1; _btnBox.find("span").eq(jsq).addClass("cur").siblings().removeClass("cur"); }; } ); /*底部按钮*/ _btnBox.find("span").hover(function () { clearInterval(timer); } , function () { if (Car == true) { if (ID_liLen > number) { timer = setInterval(Carousel, Interval); } else { clearInterval(timer); _btn_left.hide(); _btn_right.hide(); _btnBox.hide(); } } else { clearInterval(timer); } } ).click(function () { cbtmBtn = $(this).index(); $(this).addClass("cur").siblings().removeClass("cur"); if (cbtmBtn > jsq) { cj = cbtmBtn - jsq; jsq = cbtmBtn; _ID.find("ul").stop().animate({ left: -moveLengh * cj } , speed, function () { for (i = 0; i < cj; i++) { _ID.find("ul").css({ "left": 0 } ) _ID.find("li:first").insertAfter(_ID.find("li:last")); }; } ); } else { cj = jsq - cbtmBtn; jsq = cbtmBtn; _ID.find("ul").css({ "left": -moveLengh * cj } ); for (i = 0; i < cj; i++) { _ID.find("ul").stop().animate({ left: 0 } , speed); _ID.find("li:last").insertBefore(_ID.find("li:first")); }; }; } ); } $('.header_nav #nav > ul > li').mouseenter(function(){ $(this).children('ul').show(); }); $('.header_nav #nav > ul > li').mouseleave(function(){ $(this).children('ul').hide(); }); $('.header_nav #nav > ul > li > ul > li').mouseenter(function(){ $(this).children('ul').show(); }); $('.header_nav #nav > ul > li > ul > li').mouseleave(function(){ $(this).children('ul').hide(); }); $('.header_nav #nav > ul > li > ul > li > ul > li').mouseenter(function(){ $(this).children('ul').show(); }); $('.header_nav #nav > ul > li > ul > li > ul > li').mouseleave(function(){ $(this).children('ul').hide(); }); function _addFavorite() { var url = window.location; var title = document.title; var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("360se") > -1) { alert("由于360浏览器功能限制,请按 Ctrl+D 手动收藏!"); } else if (ua.indexOf("msie 8") > -1) { window.external.AddToFavoritesBar(url, title); //IE8 } else if (document.all) {//IE类浏览器 try{ window.external.addFavorite(url, title); }catch(e){ alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!'); } } else if (window.sidebar) {//firfox等浏览器; window.sidebar.addPanel(title, url, ""); } else { alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!'); } } function showbg(e) { var t = $("#flashs .btn span").index($("#flashs .btn span.cur")); t < 0 && (t = 0), $("#flashs .btn span.cur").css("opacity", .7).removeClass("cur"), $("#flashbg" + t).css({ opacity: 0, "z-index": 1 } ), $("#flashbg" + showIndex).css({ "z-index": 2 } ), $("#flashbg" + showIndex).animate({ opacity: 1 } , 500), $("#flashs .btn span").eq(showIndex).css("opacity", 1).addClass("cur") } var showIndex = 1, h = $("#flashs div.bgitem").css("opacity", 0).length, btn = "
"; for (var i = 0; i < h; i++) btn += "" + (i + 1) + ""; btn += "
", $("#flashs").append(btn); $('#flashs .btn').css({'margin-left':(-1*$('#flashs .btn').innerWidth())/2 + 'px'}); $("#flashs .btn span").css("opacity", .7).mouseenter(function () { showIndex = $("#flashs .btn span").index(this), showbg(showIndex) } ).eq(0).trigger("mouseenter"), $("#flashs").hover(function () { clearInterval(picTimer) } , function () { picTimer = setInterval(function () { showIndex++, showIndex == h && (showIndex = 0), showbg(showIndex) } , 6000) } ).eq(0).trigger("mouseleave"); $( function () { $(".pro .leftpro .menu li").eq(0).find(".nmenu").show(); $(".pro .leftpro .menu li").eq(1).find(".nmenu").show(); $(".pro .leftpro .menu li").click( function () { $(this).find(".nmenu").slideDown() $(this).siblings().find(".nmenu").slideUp() $(this).addClass("cur") $(this).siblings().removeClass("cur"); } ) } ); $('.pro .leftpro .menu li .nmenu > div').mouseenter(function(){ $(this).children('.submenu').show(); }); $('.pro .leftpro .menu li .nmenu > div').mouseleave(function(){ $(this).children('.submenu').hide(); }); mswMove("hezuo", "hezuobtn01", "hezuobtn02", "", true, "left", true, 202, 1000, 3000, 5); mswMove("case", "caseleft", "caseright", "", true, "left", true, 344, 1000, 3000, 3);mswMove("zhengshu", "zsbtn01", "zsbtn02", "", true, "left", true, 254, 1000, 3000, 4);// JavaScript Document (function($){ //传入的$为jq对象 $.fn.ajaxsubmit = function(options){ var defaults = { tip: $(''), success: function(ret){ }, returnform:true, tiptimeout:2000, processing:'正在处理……' } var tools = { success: function (msg, tipout) { var html = $(''); html.appendTo('body'); if (html.css('display') != 'none') return; html.fadeIn(100); setTimeout(function () { html.remove(); }, tipout); }, error: function (msg, tipout) { if(typeof(msg) == 'undefined'){ msg = '错误'; } var html = $('
' + msg + '
'); html.appendTo('body'); html.fadeIn(100); setTimeout(function () { html.remove(); }, tipout); }, /* *验证一个表单 */ formcheck: function(form){ var ret = true; $(form).find('[dataType]').each(function (index, element) { var type = $(element).attr('dataType'); errorinfo = '错误'; switch(type){ case 'm' : ret = valid.isMobile($(this).val()); break; case 'p' : ret = valid.isPhone($(this).val()); break; case 'e' : ret = valid.isEmail($(this).val()); break; case 't' : ret = valid.isTel($(this).val()); break; case 'u' : ret = valid.isUrl($(this).val()); break; case '*' : ret = !(valid.isEmpty($(this).val())); break; } if(!ret){ errorinfo = $(this).attr('errormsg'); //验证错误时自动获取焦点 $(this).focus(); return false; } }); return ret; } }; var valid = { //手机号码验证 /** * 匹配phone */ isPhone: function (str) { if (str == null || str == "") { errorinfo = '电话号码不能为空'; return false; } var result = str.match(/^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/); if (result == null){ errorinfo = '电话号码格式错误'; return false; } return true; } , /** * 匹配mobile */ isMobile: function (str) { if (str == null || str == "") return false; var result = str.match(/^((\(\d{2,3}\))|(\d{3}\-))?((13\d{9})|(15\d{9})|(18\d{9})|(17\d{9}))$/); if (result == null)return false; return true; } , /** * 联系电话(手机/电话皆可)验证 */ isTel: function (text) { if (isMobile(text) || isPhone(text)) return true; return false; } , /** * 匹配Email地址 */ isEmail: function (str) { if (str == null || str == "") return false; var result = str.match(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/); if (result == null)return false; return true; } , /** * 匹配URL */ isUrl: function (str) { if (str == null || str == "") return false; var result = str.match(/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\’:+!]*([^<>\"])*$/); if (result == null)return false; return true; } , /** *是否为空 */ isEmpty: function(str) { return str.replace(/(^\s*)|(\s*$)/g,"") == ''; } }; //合并配置 var opts = jQuery.extend({}, defaults, options); return this.each(function(index, element) { $(element).submit(function(e) { if(tools.formcheck(element)){ var url = $(element).attr('action'); var data = $(element).serialize(); var method = $(element).attr('method'); var callback = typeof($(element).attr('callback')) == 'undefined' ? 'jump' : $(element).attr('callback'); //正在处理 opts.tip.find('.msgbox').html(opts.processing); $('body').append(opts.tip); opts.tip.show(); $.ajax({ url : url, data : data, type : method, dataType:"json", success:function(ret){ //得到结果之后如何处理 //成功并且指定要跳转 opts.tip.find('.msgbox').html(ret.msg); if(ret.code == 1){ //设置正确信息 opts.tip.css('color', 'green'); // opts.tip.find('.msgbox').html(ret.msg); opts.tip.find('.msgbox').html('提交成功!客服人员将在30分钟内与您联系'); //通过form上面的callback属性指定跳转回调 if(callback == "reload"){ window.location.reload(); }else{ //回调方法 opts.success(ret); } if(opts.returnform){ element.reset(); } }else{ opts.tip.css('color', '#d9534f'); } setTimeout(function(){ opts.tip.hide(); }, opts.tiptimeout); } }); }else{ tools.error(errorinfo, 1000); } //禁止同步跳转 return false; }); }); } })(jQuery); (function($){ $.fn.serializeObject = function() { if ( !this.length ) { return false; } var $el = this, data = {}, lookup = data; //current reference of data $el.find(':input[type!="checkbox"][type!="radio"], input:checked').each(function() { // data[a][b] becomes [ data, a, b ] var named = this.name.replace(/\[([^\]]+)?\]/g, ',$1').split(','), cap = named.length - 1, i = 0; for ( ; i < cap; i++ ) { // move down the tree - create objects or array if necessary lookup = lookup[ named[i] ] = lookup[ named[i] ] || ( named[i+1] == "" ? [] : {} ); } // at the end, psuh or assign the value if ( lookup.length != undefined ) { lookup.push( $(this).val() ); }else { lookup[ named[ cap ] ] = $(this).val(); } // assign the reference back to root lookup = data; }); return data; }; })(jQuery); var mySwiper = new Swiper('.swiper-container', { autoplay: 5000, pagination : '.swiper-pagination', }); $('#form input').keyup(function(){ var data = $('#form').serializeObject(); var content = ''; content += '姓名:'+data.yourname+'\n'; content += '电话:'+data.yourtel+'\n'; content += '备注:' + data.yourremark+'\n'; $('#contentxx').val(content); }); $('#form').ajaxsubmit();function Marquee() { this.ID = document.getElementById(arguments[0]); if(!this.ID) { alert("您要设置的\"" + arguments[0] + "\"初始化错误\r\n请检查标签ID设置是否正确!"); this.ID = -1; return; } this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.CTL = this.StartID = this.Stop = this.MouseOver = 0; this.Step = 1; this.Timer = 30; this.DirectionArray = { "top":0 , "up":0 , "bottom":1 , "down":1 , "left":2 , "right":3}; if(typeof arguments[1] == "number" || typeof arguments[1] == "string")this.Direction = arguments[1]; if(typeof arguments[2] == "number")this.Step = arguments[2]; if(typeof arguments[3] == "number")this.Width = arguments[3]; if(typeof arguments[4] == "number")this.Height = arguments[4]; if(typeof arguments[5] == "number")this.Timer = arguments[5]; if(typeof arguments[6] == "number")this.DelayTime = arguments[6]; if(typeof arguments[7] == "number")this.WaitTime = arguments[7]; if(typeof arguments[8] == "number")this.ScrollStep = arguments[8]; this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden"; this.ID.noWrap = true; this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1); if(arguments.length >= 7)this.Start(); } Marquee.prototype.Start = function() { if(this.ID == -1)return; if(this.WaitTime < 800)this.WaitTime = 800; if(this.Timer < 20)this.Timer = 20; if(this.Width == 0)this.Width = parseInt(this.ID.style.width); if(this.Height == 0)this.Height = parseInt(this.ID.style.height); if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()]; this.HalfWidth = Math.round(this.Width / 2); this.HalfHeight = Math.round(this.Height / 2); this.BakStep = this.Step; this.ID.style.width = this.Width + "px"; this.ID.style.height = this.Height + "px"; if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height; var templateLeft = "
MSCLASS_TEMP_HTMLMSCLASS_TEMP_HTML
"; var templateTop = "
MSCLASS_TEMP_HTML
MSCLASS_TEMP_HTML
"; var msobj = this; msobj.tempHTML = msobj.ID.innerHTML; if(msobj.Direction <= 1) { msobj.ID.innerHTML = templateTop.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML); } else { if(msobj.ScrollStep == 0 && msobj.DelayTime == 0) { msobj.ID.innerHTML += msobj.ID.innerHTML; } else { msobj.ID.innerHTML = templateLeft.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML); } } var timer = this.Timer; var delaytime = this.DelayTime; var waittime = this.WaitTime; msobj.StartID = function(){ msobj.Scroll()} msobj.Continue = function() { if(msobj.MouseOver == 1) { setTimeout(msobj.Continue,delaytime); } else { clearInterval(msobj.TimerID); msobj.CTL = msobj.Stop = 0; msobj.TimerID = setInterval(msobj.StartID,timer); } } msobj.Pause = function() { msobj.Stop = 1; clearInterval(msobj.TimerID); setTimeout(msobj.Continue,delaytime); } msobj.Begin = function() { msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth / 2 : msobj.ID.scrollHeight / 2; if((msobj.Direction <= 1 && msobj.ClientScroll <= msobj.Height + msobj.Step) || (msobj.Direction > 1 && msobj.ClientScroll <= msobj.Width + msobj.Step)) { msobj.ID.innerHTML = msobj.tempHTML; delete(msobj.tempHTML); return; } delete(msobj.tempHTML); msobj.TimerID = setInterval(msobj.StartID,timer); if(msobj.ScrollStep < 0)return; msobj.ID.onmousemove = function(event) { if(msobj.ScrollStep == 0 && msobj.Direction > 1) { var event = event || window.event; if(window.event) { if(msobj.IsNotOpera) { msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX; } else { msobj.ScrollStep = null; return; } } else { msobj.EventLeft = event.layerX - msobj.ID.scrollLeft; } msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2; msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft); msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth); } } msobj.ID.onmouseover = function() { if(msobj.ScrollStep == 0)return; msobj.MouseOver = 1; clearInterval(msobj.TimerID); } msobj.ID.onmouseout = function() { if(msobj.ScrollStep == 0) { if(msobj.Step == 0)msobj.Step = 1; return; } msobj.MouseOver = 0; if(msobj.Stop == 0) { clearInterval(msobj.TimerID); msobj.TimerID = setInterval(msobj.StartID,timer); } } } setTimeout(msobj.Begin,waittime); } Marquee.prototype.Scroll = function() { switch(this.Direction) { case 0: this.CTL += this.Step; if(this.CTL >= this.ScrollStep && this.DelayTime > 0) { this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } else { if(this.ID.scrollTop >= this.ClientScroll) { this.ID.scrollTop -= this.ClientScroll; } this.ID.scrollTop += this.Step; } break; case 1: this.CTL += this.Step; if(this.CTL >= this.ScrollStep && this.DelayTime > 0) { this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } else { if(this.ID.scrollTop <= 0) { this.ID.scrollTop += this.ClientScroll; } this.ID.scrollTop -= this.Step; } break; case 2: this.CTL += this.Step; if(this.CTL >= this.ScrollStep && this.DelayTime > 0) { this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } else { if(this.ID.scrollLeft >= this.ClientScroll) { this.ID.scrollLeft -= this.ClientScroll; } this.ID.scrollLeft += this.Step; } break; case 3: this.CTL += this.Step; if(this.CTL >= this.ScrollStep && this.DelayTime > 0) { this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } else { if(this.ID.scrollLeft <= 0) { this.ID.scrollLeft += this.ClientScroll; } this.ID.scrollLeft -= this.Step; } break; } } new Marquee("wenda", 0, 1, 365, 380, 40, 0, 1000, 22); $(".yb_conct").hover(function() { $(".yb_conct").css("right", "5px"); $(".yb_bar .yb_ercode").css('height', '200px'); }, function() { $(".yb_conct").css("right", "-127px"); $(".yb_bar .yb_ercode").css('height', '53px'); }); // 返回顶部 $(".yb_top").click(function() { $("html,body").animate({ 'scrollTop': '0px' }, 300) });