$(function () { wowInt(); findTel(); phoneTargetSelf(); nav(); search(); select(); faq(); //首页banner可以带视频效果 $(window).resize(); var mySwiper = new Swiper('.banner .swiper-container',{ //pagination : '.banner .swiper-pagination', //grabCursor: true, //paginationClickable: true, prevButton:'.banner .swiper-button-prev', nextButton:'.banner .swiper-button-next', autoplay:5000, speed:1000, loop: false, autoplayDisableOnInteraction : false, onInit: function(swiper){ swiperAnimateCache(swiper); swiperAnimate(swiper); }, onSlideChangeEnd: function(swiper){ swiperAnimate(swiper); var _this = $('.banner .swiper-slide').eq(swiper.activeIndex); if($(window).width()>767){ videoSelect(_this); } } }) if($("html").hasClass("lt10")){ var test2 = setInterval(function () { mySwiper.slideNext(); }, 5000); $(".banner").hover(function(){ clearInterval(test2); },function(){ test2 = setInterval(function () { mySwiper.slideNext(); }, 5000); }) } if($(window).width()>767){ videoSelect($('.banner .swiper-slide.swiper-slide-active')); } function videoSelect(_this){ var flag = true; var cc = _this.hasClass('ban_video'); if(cc){ mySwiper.stopAutoplay(); var videos = ''; _this.append(videos); var aaa = setInterval(function(){ if(!isNaN($(".vv").get(0).duration)&&flag){ clearInterval(aaa); flag=false; setTimeout(function(){ _this.find('video').css("display","block"); },500) } },10); _this.find('video').bind('ended',function () { mySwiper.slideNext(); mySwiper.startAutoplay(); }); }else{ $('.vv').remove(); } } //首页banner end //banner向下箭头 $(".banner .down").click(function () { var h_h = $(".header").outerHeight(); $('html,body').animate({scrollTop: $('.index-part01').offset().top - h_h}, 1000); }) $(".inbanner .down").click(function () { var h_h = $(".header").outerHeight(); $('html,body').animate({scrollTop: $('.one_sec').offset().top - h_h}, 1000); }) //banner向下箭头end //顶部悬浮 $(window).scroll(function(){ if($(window).scrollTop()>0){ $("body").addClass("scroll-header"); }else{ $("body").removeClass("scroll-header"); } }) //顶部悬浮end $(document).on("click", ".remember", function () { $(this).toggleClass("on"); }) //产品与应用导航2级切换 if($(window).width()>1024){ $(".tab-box .tab-a").each(function() { $(this).hover(function() { if (!$(this).hasClass("off")) { $(this).addClass("on").siblings().removeClass("on"); var ii=$(this).index(); $(this).parents(".tab-box").find(".tab-b").eq(ii).show().siblings().hide(); } }); }) $(".tab-box").each(function (i) { $(this).find(".tab-a:eq(0)").addClass("on"); }); }else{ $(document).on("click", ".item_t_phone", function () { $(this).parent(".tab-b").siblings().find(".item_t_phone").removeClass("on"); $(this).parent(".tab-b").siblings().find(".item").slideUp(); $(this).toggleClass("on"); $(this).siblings(".item").slideToggle(); }) } //end //手机号中间4位*号 var phone = $('.phone_num').text(); var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11); $('.phone_num').text(nPhone); //手机验证码倒计时 var countdown = 60; //$('.count button').on('click',function(){ // var obj = $(".count button"); // settime(obj); //}) function settime(obj) { if (countdown == 0) { $('.count button').text('获取短信验证码').removeAttr('disabled'); $(".count button").removeAttr("style"); countdown = 60; return; } else { $('.count button').attr('disabled', true); $('.count button').text("(剩余"+ countdown +"s)"); countdown--; } setTimeout(function () { settime(obj) } , 1000) } //新增加的 $(".leftItem").each(function (x) { $(this).click(function(){ console.log(x) $(".rightItem").eq(x).addClass("on").siblings().removeClass("on") }) }) if($(".newpro_tit01 li").length>0){ $(document).on("click",".newpro_tit01 li",function(){ var index=$(this).index() $(this).addClass("on").siblings().removeClass("on") $(".newlevel_wrap").eq(index).addClass("on").siblings(".newlevel_wrap").removeClass("on") imgratio() }) } if($(".newlevel_wrap .pro_tit02 li").length>0){ $(document).on("click",".newlevel_wrap .pro_tit02 li",function(){ var index=$(this).index() $(this).addClass("on").siblings().removeClass("on") $(this).parents(".pro_tit02").siblings(".pro_li-con").find(".pro_li-conItem").eq(index).addClass("on").siblings(".pro_li-conItem").removeClass("on") imgratio() }) } if($(".twopro_list li").length>0){ $(document).on("click",".twopro_list li",function(){ var index=$(this).index() $(this).addClass("on").siblings().removeClass("on") $(".pro_tit04>ul").eq(index).addClass("on").siblings("ul").removeClass("on") }) } //$(document).on("mouseover",".nav ul>li:eq(1)",function(e){ // e.stopPropagation() // $("#navlist").slideDown() //}) //$(document).on("mouseleave",".nav ul>li:eq(1)",function(){ // $("#navlist").slideUp() //}) }) //主导航 function nav(){ if($(window).width()>1024){ $(".nav ul>li").hover(function() { $(this).find(".navlist").stop().slideDown(); }, function() { $(this).find(".navlist").hide(); }); //$(".navlist").hover(function(){ // $(.navlist").stop().slideDown(); //},function(){ // $(.navlist").stop().slideUp(); //}) }else{ $(".navlist").siblings("span").addClass("cur"); $(document).on('click','.nav_phone_btn',function(e){ e.preventDefault(); e.stopPropagation(); $('.nav_phone_btn').toggleClass('visible_nav'); $('body').toggleClass('body_nav_phone'); $(".nav_click").show(); }); $(".nav_click").click(function(){ $('.nav_phone_btn').removeClass('visible_nav'); $('body').removeClass('body_nav_phone'); $(this).hide(); }) $(".nav ul li span").click(function(){ $(this).parent("li").siblings().find("span").removeClass("on"); $(this).parent("li").siblings().find(".navlist").slideUp(); $(this).toggleClass("on"); $(this).siblings(".navlist").slideToggle(); }) } } //搜索 function search(){ $(".head_rr span.ser").click(function (e) { e.preventDefault(); e.stopPropagation(); $(this).toggleClass("on"); //$(".search_wrap").slideToggle(200); $(".search_wrap").toggleClass("on"); }) $(".search_box_text").click(function (e) { e.preventDefault(); e.stopPropagation(); }) $(document).click(function(){ //$(".search_wrap").slideUp(200); $(".search_wrap").removeClass("on"); $("span.ser").removeClass("on"); }) } //点击分享 function share(){ $(".share_wb").click(function () {//微博 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://service.weibo.com/share/share.php?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op) }) /* $(".share_in").click(function () {//linkedin var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "//www.linkedin.com/uas/login?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); }) $(".share_bdtb").click(function () {//百度贴吧 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://tieba.baidu.com/f/commit/share/openShareApi?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); })*/ $(".share_qqkj").click(function () {//腾讯微博 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op) }) $(".share_qq").click(function () {//QQ var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://connect.qq.com/widget/shareqq/index.html?url=" + encodeURIComponent(url) + ""; window.open(op); }) $(".share_douban").click(function () {//豆瓣 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "https://www.douban.com/share/service?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); }) //微信 $(".share_wx").attr("data-qrcode","http://www.xinhongru.com/qrcode/qrcode.php?content="+window.location.href); $(".share_wx").click(function () {//微信 //var url = "/qrCode/Index.aspx?url=" + window.location.href; var url = $(this).attr("data-qrcode") console.log(url) var title = "" title += "
" title += "x" title += "

二维码

" title += "
" title += "

扫一扫

" title += "
" $("body").remove(".weixin"); $("body").append(title) }) $(document).on("click", ".weixin .c", function () { $(".weixin").remove(); }) } //模拟下拉select function select(){ $(".select-box").each(function (i) { $(this).find("dt").click(function (e) { e.preventDefault(); e.stopPropagation(); var el = $(this).parent(".select-box"); if(el.hasClass('open')){ el.removeClass('open'); el.find("dt i.icon-arrow-down").removeClass("icon-arrow-up"); }else{ el.addClass('open'); el.find("dt i.icon-arrow-down").addClass("icon-arrow-up"); el.parents("li").siblings("li").find(".select-box").removeClass('open'); //el.parents("li").siblings("li").find(".check-box").removeClass('open'); } }) $(".select-box").eq(i).find("dd a").each(function (x) { $(this).click(function () { var inde = $(this).index(); $(this).addClass("on").siblings().removeClass("on"); var el = $(".select-box.open"); el.next(".select-hidden").val($(this).attr("data-val")) el.find("dt a").text($(this).text()); el.find("dd a").eq(inde).addClass("on").siblings().removeClass("on"); //点击下拉选择数据显示 /*$('.sear-wrap').find(".choose").addClass("on"); var cl = $(".sear-wrap .choose"); if($('.sear-wrap').find(".choose dd").eq(i).find("span").size()<1){ var str = 'X'; $('.sear-wrap').find(".choose dd").eq(i).append(str); cl.find("dd").eq(i).find("i").text($(this).text()); } cl.find("dd").eq(i).find("i").text($(this).text());*/ setTimeout(function () { el.removeClass("open"); },1) }) }) //X按钮 $(document).on("click", ".choose dd em", function (){ $(this).parent("span").remove(); //$(".select-box").eq(i).find("dt a").text("请选择"); if($(".choose").find("span").size()<=0){ $(".choose").removeClass("on"); } }) //页面下拉重置按钮 $(".app-reset").click(function () { $(this).parents("ul").find(".select-box dt a").text("请选择"); $('.sear-wrap').find(".choose").removeClass("on"); $(this).parents("ul").find(".select-box dd a").removeClass("on"); $('.sear-wrap').find(".choose dd span").remove(); }) }) $(document).click(function () { $(".select-box.open").removeClass("open"); }) } function faq(){ $(".faq-con li .faq-t").click(function(){ $(this).siblings(".faq-c").slideToggle().parents("li").siblings("li").find(".faq-c").slideUp(); $(this).toggleClass("active").parents("li").siblings("li").removeClass("on"); $(this).toggleClass("active").find("i").addClass("icon-jianhao"); if($(this).parents("li").hasClass("on")){ $(this).parents("li").removeClass('on'); } else{ $(this).parents("li").addClass("on"); } }) //$(".faq-con li").eq(0).find(".faq-t").click(); } //wow入场 function wowInt(){ if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){ var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: -100, mobile: true, live: true }); wow.init(); }; } /*手机端链接改为本窗口打开*/ function phoneTargetSelf(context){ if ($(window).width()<1024) { if(context==undefined){ context=$(document); } $('a',context).each(function(){ var target=$(this); var link=target.attr('target'); target.attr('target','_self'); }) } } /*电话链接取消默认事件并添加样式*/ function findTel(context){ if ($(window).width()>1024) { var condition = /^tel\:([0-9\-]+)|tel\:\+([0-9\-]+)$/; if(context==undefined){ context=$(document); } $('a',context).each(function(index, el) { var target=$(this); var href=target.attr('href'); if (condition.test(href)) { target.addClass('tel_link'); target.on('click',function(event){ event.preventDefault(); }) } }); } } /*ie9的placeholder包含密码框的兼容*/ $(function(){ if(!placeholderSupport()){ // 判断浏览器是否支持 placeholder $('input').not("input[type='password']").each( function() { var self = $(this); var val = self.attr("placeholder"); input(self, val); /*if($(this).val()=="" && $(this).attr("placeholder")!=""){ $(this).val($(this).attr("placeholder")); $(this).focus(function(){ if($(this).val()==$(this).attr("placeholder")) $(this).val(""); }); $(this).blur(function(){ if($(this).val()=="") $(this).val($(this).attr("placeholder")); }); }*/ } ); $('input[type="password"]').each( function() { var pwdField = $(this); var pwdVal = pwdField.attr('placeholder'); var pwdClass = pwdField.attr('class'); // 重命名该input的id为原id后跟1 pwdField.after(''); var pwdPlaceholder = $(this).siblings('.login-input'); pwdPlaceholder.show(); pwdField.hide(); pwdPlaceholder.focus(function(){ pwdPlaceholder.hide(); pwdField.show(); pwdField.focus(); }); pwdField.blur(function(){ if(pwdField.val() == '') { pwdPlaceholder.show(); pwdField.hide(); } }); } ); }; }) // 判断浏览器是否支持placeholder属性 function placeholderSupport() { return 'placeholder' in document.createElement('input'); } // jQuery替换placeholder的处理 function input(obj, val) { var $input = obj; var val = val; $input.attr({value:val}); $input.focus(function() { if ($input.val() == val) { $(this).attr({value:""}); } }).blur(function() { if ($input.val() == "") { $(this).attr({value:val}); } }); } /*ie9的placeholder包含密码框的兼容end*/ // 视频弹框 $(function(){ $('.xmn_tabSet li').on('click',function(){ var src = $(this).data('src') $('.video video').attr('src',src) $('.popUp').show() $('.video video').trigger('play'); }) // 关闭 $('.video span').on('click',function(){ $('.popUp').hide() $('.video video').trigger('pause'); }) })