$(function () { // window.document.oncontextmenu = function () { return false; } /(iPhone|iPad|iPhone OS|Phone|iPod|iOS)/i.test(navigator.userAgent)&&(head=document.getElementsByTagName("head"),viewport=document.createElement("meta"),viewport.name="viewport",viewport.content="target-densitydpi=device-dpi, width=640px, user-scalable=no",head.length>0&&head[head.length-1].appendChild(viewport)); $("a").focus(function () { //去掉边线 $(this).blur(); }); share()//分享 nav(); toolbar(); //qq在线 //首页选中状态 $(".ewmbtn").click(function(){ $("body .ewmbox").show(); layout(1); }); $(".ewmbox .close").click(function(){ $(".ewmbox").hide(); layout(0); }); }); var searchVa = $("#keyWord").val(); $("#keyWord").focus(function () { if ($(this).val() == searchVa) { $(this).val(""); } }).blur(function () { if ($(this).val() == "") { $(this).val(searchVa); } }); var deafult = $.trim($('#keyWord').val()); function topSearchUnit() { var _kw = $.trim($('#keyWord').val()); if (_kw != '' && _kw != deafult) { //20为分页条数 window.location.href = '/searchresults/' + _kw + '/{}/1/20'; } else { alert("请输入关键字"); $("#keyWord").focus(); } } function toolbar() { $('#toolbar dd').bind({ 'mouseenter': function () { if ($(this).children('.slide').length) { var _this = $(this).children('.slide'); _this.stop(true, true).animate({ 'width': 170 }, 200); } else if ($(this).children('.pop').length) { var _this = $(this).children('.pop'); _this.show().animate({ 'right': 65 }, 200); } }, 'mouseleave': function () { if ($(this).children('.slide').length) { var _this = $(this).children('.slide'); _this.stop(false, false).animate({ 'width': 0 }, 200); } else if ($(this).children('.pop').length) { var _this = $(this).children('.pop'); _this.hide().animate({ 'right': 80 }, 200); } } }); $(".fix_top").click(function () { $("body, html").stop().animate({ "scrollTop": 0 }); }); } function SubMessage() { var username = $("#username").val(); var tel = $("#tel").val(); if (username == "" || username == "姓名") { alert("您的姓名不能为空"); $("#username").focus(); return false; } if (tel == "" || tel == "手机") { alert("您的手机不能为空"); $("#tel").focus(); return false; } var length = tel.length; if (length == 11 ) { $.ajax({ url: '/ajax/message/send', type: 'POST', data: $(form).serialize(), dataType: 'JSON', success: function (result) { // me.holdSubmit(false); alert(result.msg); if (result.flag) { $(form)[0].reset(); } }, error: function (xhr) { //me.holdSubmit(false); alert(xhr.responseText); } }); } else { alert("您的手机不正确"); $("#tel").focus(); return false; } } function nav() { //导航条鼠标滑过; $(".nav ul li").hover(function () { $(this).children("a").addClass("hover"); $(this).siblings().children("a").removeClass("hover"); $(this).children("dl").slideDown(); }, function () { $(this).children("a").removeClass("hover") $(this).children("dl").hide(); $(".nav ul li a").removeClass("hover"); //状态保存 $(".nav ul li a").each(function (i) { if ($(this).attr("href") != "/") { if (window.location.href.indexOf($(this).attr("href")) > -1) { $(this).addClass("hover"); } } }); }); } function share(){ window._bd_share_config={ "common":{ "bdSnsKey":{}, "bdText":"", "bdMini":"1", "bdMiniList":["sqq","qzone","weixin","tsina"], "bdPic":"","bdStyle":"0","bdSize":"16" }, "share": {}, "slide":{"type":"slide","bdImg":"4","bdPos":"left","bdTop":"170.5"} }; with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]; } function layout(u){ var $obj = $('
'); if(u == 0){ $('.dialog-layout').remove(); }else{ if(!$('.dialog-layout').length){ $obj.appendTo('body').show(); } } }