/*-----------------------------------------------------------*/ /*copyright by 动力无限 www.btoe.cn*/ /*邮箱 btoe@btoe.cn*/ /*合作电话 400-0599-360*/ /*版权所有违者必究*/ /*-----------------------------------------------------------*/ $('.gotop').click(function () { $('html,body').animate({ scrolltop: '0px' }, 'slow'); }); $(function () { var stop = 0; var x = $("#fixednav").offset().top; $(window).scroll(function () { stop = $(this).scrolltop(); if (stop >= 1) { $("#fixednav").addclass("fixednav"); } else { $("#fixednav").removeclass("fixednav"); } }); }); // 顶部显示 $(function () { $('#xunpantext').hover(function () { var xunpantext = $(this).data('tiptitle'); $('#xunpantip').css({ top: $(this).outerheight(true) + 8 + 'px' }); $('#xunpantip').text(xunpantext); $('#xunpantip').addclass('xunpantextactive'); }, function () { $('#xunpantip').removeclass('xunpantextactive') }) }) $(function () { $('#btn').on('click', function () { var kcontent = $('#contant').val(); var kuser = $('#name').val(); var kphone = $('#tel').val(); var kcode = $('#codetext').val().trim(); // var kemail = $('.useremail').val(); var reg = /(^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$)|(^((\(\d{3}\))|(\d{3}\-))?(1[3578]\d{9})$)|(^400[0-9]{7})/; if (kuser == "") { var txt= "姓名不能为空!"; var option = { title: "温馨提示:", btn: parseint("0011",2), onok: function(){ console.log("确认啦"); } } window.wxc.xcconfirm(txt, "custom", option); $("#name").focus(); return false; } if (kphone == "") { var txt= "号码不能为空!"; var option = { title: "温馨提示:", btn: parseint("0011",2), onok: function(){ console.log("确认啦"); } } window.wxc.xcconfirm(txt, "custom", option); $("#tel").focus(); return false; } if (!reg.test(kphone)) { var txt= "号码填写有误!"; var option = { title: "温馨提示:", btn: parseint("0011",2), onok: function(){ console.log("确认啦"); } } window.wxc.xcconfirm(txt, "custom", option); $("#tel").focus(); return false; } if (kcontent == "" || kcontent.length < 10) { var txt= "留言内容必须大于10字!"; var option = { title: "温馨提示:", btn: parseint("0011",2), onok: function(){ console.log("确认啦"); } } window.wxc.xcconfirm(txt, "custom", option); $("#contant").focus(); return false; } if (kcode == "") { var txt= "验证码不能为空"; var option = { title: "温馨提示:", btn: parseint("0011",2), onok: function(){ console.log("确认啦"); } } window.wxc.xcconfirm(txt, "custom", option); $("#codetext").focus(); return false; } $.post('/api/message.ashx?action=add', { "kcontent": '信息 :' + kcontent, "kuser": kuser, "kphone": kphone, "kcode": kcode }, function (res) { if (res === 1) { var txt= "留言提交成功"; var option = { title: "温馨提示:", btn: parseint("0011",2), onok: function(){ console.log("确认啦"); } } window.wxc.xcconfirm(txt, "custom", option); $('#contant').val(''); $('#name').val(''); $('#tel').val(''); } else { var txt= "留言提交成功"; var option = { title: "温馨提示:", btn: parseint("0011",2), onok: function(){ console.log("确认啦"); } } window.wxc.xcconfirm(txt, "custom", option); } }) }) }) //验证码刷新 $("#imgcode").click(function () { $(this)[0].src = '/api/message.ashx?action=code&' + math.random() }); // alert (function($){ window.wxc = window.wxc || {}; window.wxc.xcconfirm = function(pophtml, type, options) { var btntype = window.wxc.xcconfirm.btnenum; var eventtype = window.wxc.xcconfirm.eventenum; var poptype = { custom: { title: "", icon: "", btn: btntype.ok } }; var itype = type ? type instanceof object ? type : poptype[type] || {} : {};//格式化输入的参数:弹窗类型 var config = $.extend(true, { //属性 title: "", //自定义的标题 icon: "", //图标 btn: btntype.ok, //按钮,默认单按钮 //事件 onok: $.noop,//点击确定的按钮回调 oncancel: $.noop,//点击取消的按钮回调 onclose: $.noop//弹窗关闭的回调,返回触发事件 }, itype, options); var $txt = $("
").html(pophtml);//弹窗文本dom
var $tt = $("").addclass("tt").text(config.title);//标题
var icon = config.icon;
var $icon = icon ? $("