$(function () { wowInt(); findTel(); phoneTargetSelf(); nav(); search(); ProType(); //countdown(); MemberEye(); sociology(); share(); test(); test_details(); if($(window).width()>767){ ScollText(".honor_text") } $(document).on("click",".v_close02,.v_close",function(){ $(".v_blank_70,.v_tac").fadeOut(); }) $(document).on("click",".sex_select span",function(){ $(this).addClass("on").siblings().removeClass("on"); }) select(); address(); $(window).resize(); }) function nav(){ $(".header_shop").hover(function(){ $(this).find("dd").stop().fadeIn(); },function(){ $(this).find("dd").stop().fadeOut() }) $(window).scroll(function () { if ($(this).scrollTop() > 0) { $('body').addClass('scrollHeader'); } else { $('body').removeClass('scrollHeader'); } }); if($(window).width()>1200){ $(".nav li").hover(function(){ $(this).find(".nav_list").stop().fadeIn(); $(this).siblings().find(".nav_list").stop().fadeOut() },function(){ $(this).find(".nav_list").stop().fadeOut() }) $(document).on("click", ".nav_phone_btn", function () { $(this).parents("body").toggleClass("menu-open"); }); $(".nav_phone_btn").hover(function(){ $("body").addClass("menu-open"); },function(){ }) }else{ $(".nav_phone_btn").click(function(){ $(this).toggleClass("visible_nav"); $("body").toggleClass("navbody"); $(".nav>ul>li").removeClass("cur"); }) } $(".nav>ul>li>span").click(function(){ $(this).parent("li").addClass("cur"); }) $(".return_a").click(function(){ $(this).parents("li").removeClass("cur"); }) if($(window).width()<1025){ $(".header_box").on('touchmove',function(event){ event.preventDefault(); event.stopPropagation(); }) } } function search() { $(document).on("click",".search_btn",function(e){ e.preventDefault() e.stopPropagation() $(this).toggleClass('on') $(this).siblings('.search_box').toggleClass('on'); if($(window).width()>1024){ $(".language dd").stop().slideUp(); } }) $(document).on("click",".search_box",function(e){ e.preventDefault() e.stopPropagation() }) $(document).click(function () { $('.search_btn').removeClass('on'); $('.search_box').removeClass('on'); if($(window).width()>1024){ $(".language dd").stop().slideUp(); } }) if($(window).width()>1024){ $(document).on("click",".language dt",function(e){ e.preventDefault() e.stopPropagation() $(this).siblings().stop().slideToggle(); $('.search_btn').removeClass('on'); $('.search_box').removeClass('on'); }) } } function select(){ $(".pub_select").each(function (i) { $(this).find("dt").click(function (e) { if($(this).hasClass('on_o')){ $(this).removeClass('on_o'); }else{ $(this).addClass('on_o'); } e.preventDefault(); e.stopPropagation() $(".pub_select").eq(i).find("dd a").each(function (x) { $(this).click(function () { $(".pub_select").removeClass("on"); $(".pub_select").eq(i).find("dd a").removeClass("on") $(this).addClass("on") $(".pub_select").eq(i).find("dt p").text($(this).text()); $(".pub_select").eq(i).find("dt").attr({"data-val":$(this).data("val")}); }) }) }) }) $(document).click(function () { $(".pub_select dd").slideUp(); $(".pub_select dt").removeClass('on_o'); }) $(".pub_select dt").on("click", function(e){ if($(this).siblings(".pub_select dd").is(":hidden")){ $(this).siblings(".pub_select dd").slideDown(); $(this).parents(".pub_select").siblings(".pub_select").children(".pub_select dd").slideUp(); $(".address_city .option").slideUp(); $(".info_input").removeClass("cur"); }else{ $(this).siblings(".pub_select dd").slideUp(); } }); } function wowInt(){ if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){ var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 100, mobile: false, live: true }); wow.init(); }; } function address(){ $(document).on("click",".modify_information .m_default i",function(){ $(this).toggleClass("on"); }) $(document).on("click",".address_list .m_default i",function(){ $(this).parents("li").toggleClass("on"); $(this).parents("li").siblings().removeClass("on"); }) $(document).on("click",".remove_address",function(){ $(this).parents("li").remove(); }) } /*手机端链接改为本窗口打开*/ 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() { // 如果不支持placeholder,用jQuery来完成 if(!isSupportPlaceholder()) { // 遍历所有input对象, 除了密码框 $('input').not("input[type='password']").each( function() { var self = $(this); var val = self.attr("placeholder"); input(self, val); } ); /**//* 对password框的特殊处理 * 1.创建一个text框 * 2.获取焦点和失去焦点的时候切换 */ $('input[type="password"]').each( function(i) { var pwdField = $(this); var pwdVal = pwdField.attr('placeholder'); var pwdId = pwdField.attr('id'); // 重命名该input的id为原id后跟1 pwdField.after(''); var pwdPlaceholder = $('#' + pwdId + ''+i+''); 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 isSupportPlaceholder() { var input = document.createElement('input'); return 'placeholder' in 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}); } }); } //end function mapInt(mapx,mapy){ var num = 0.002; var num2 = 0.0005; var map = new BMap.Map("map"); var point = new BMap.Point(mapx,mapy); if($(window).width()>1024){ var myIcon = new BMap.Icon("/images/address.png", new BMap.Size(215,215)); }else{ var myIcon = new BMap.Icon("/images/phone_address.png", new BMap.Size(44,66)); } var marker2 = new BMap.Marker(point,{icon:myIcon}); map.addOverlay(marker2); map.centerAndZoom(point, 14); map.enableScrollWheelZoom(); map.enableContinuousZoom(); } function ProType(){ $(document).on("click",".pro_type dd a",function(){ $(this).addClass("on").siblings().removeClass("on"); }) } function countdown(){ var countdown = 60; $('.count button').on('click',function(){ var obj = $(".count button"); settime(obj); }) function settime(obj) { if (countdown == 0) { $('.count button').text('获取验证码(60s)').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) } } function MemberEye(){ $(document).on("click",".eye",function(){ $(this).parent("li").toggleClass("on"); $(".eye_box").find("input").attr("type","password"); $(".eye_box.on").find("input").attr("type","text"); }) } function sociology(){ $(document).on("click",".sociology_list dt",function(){ $(this).parents("li").toggleClass("cur"); $(this).parents("li").siblings().removeClass("cur"); $(this).siblings().slideToggle(); $(this).parents("li").siblings().find("dd").slideUp(); $(this).parents("li").siblings().find("dt").slideDown(); }) } function ScollText(obj){ if($(obj).length>0){ $(obj).mCustomScrollbar({ mouseWheelPixels:500, autoDraggerLength:false, advanced: { autoScrollOnFocus: "" } }); } } function share(){ $(".share_facebook").click(function () {//Facebook var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "https://www.facebook.com/sharer.php?s=100&p[title]=" + title + "&p[summary]=!&p[url]=" + encodeURIComponent(url) + "" window.open(op) }) $(".share_twitter").click(function () {//Twitter var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "https://www.tumblr.com/login?redirect_to=https://www.tumblr.com/widgets/share/tool?shareSource=legacy&canonicalUrl=&url=" + encodeURIComponent(url) + "&title=" + title + ""; window.open(op) }) $(".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_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_bd").click(function () {//鐧惧害璐村惂 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://s.share.baidu.com/mshare?url=" + 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(); }) } function test(){ $(document).on("click",".test_close",function(){ $(".test_blank70,.test_tac").fadeOut(); }) } function test_details(){ $(document).on("click",".choice_span span",function(){ $(this).addClass("on").siblings().removeClass("on"); }) $(document).on("click",".test_list p",function(){ $(this).parent().toggleClass("on"); // $(this).parent().siblings().removeClass("on"); }) }