$(function(){ var image = new image(); image.onload = function() { var imgwidth=$('.ty-banner-1 img').width(); var windowwidth=$(window).width(); var length = (imgwidth-windowwidth)/2; if(length>0){ $('.ty-banner-1 img').attr('style','margin-left:'+ (-length) + 'px'); } $('.ty-banner-1 img').addclass('show'); } image.src = $('.ty-banner-1 img').attr('src'); }); var key = document.getelementbyid("key"); function searchinfo() { var base = $('head').data('base'); if (key.value) { location.href = base + "search.php?key=" + key.value; } else { alert('请输入您要搜索的关键词!'); } } key.addeventlistener('keypress', function(event) { var keycode = event.keycode || event.which; if (keycode == "13") { searchinfo(); } }); function searchlink(el) { var href = $(el).attr("href"); location.href = href ? href : "/search.php?key=" + $(el).html(); } $("[navcrumbs]").find("dd a").last().addclass('cur'); $(function() { navclick('.fdh-01-nav-one h3', 'dl'); navclick('.fdh-01-nav dt', 'dd'); function navclick(clickdom, showdom) { $(clickdom).on('click', function() { if ($(this).hasclass('sidenavcur')) { $(this).next(showdom).hide(); $(this).removeclass('sidenavcur'); } else { $(this).addclass('sidenavcur'); $(this).next(showdom).show(); $(this).addclass('sidenavcur'); } }); } //副导航焦点定位 var leftnavfocus1 = { init: function() { if ($(window).width() < 768) { return false; } var elnav = $("[navcrumbs]").find("a"); var elbody = $("[navvicefocus1]").find("a"); var index = 0; if (elnav && elbody) { for (var n = (elnav.length - 1); n >= 0; n--) { $.each(elbody, function(i, item) { if (elnav.eq(n).attr("href") === $(item).attr("href")) { $(item).parent().addclass("sidenavcur"); $(item).parent().next().show(); } }); } } } }; leftnavfocus1.init(); }); $(function() { var time; //var winheight = top.window.document.body.clientheight || $(window.parent).height(); $('.client-2').css({ 'margintop': -($('.client-2').height() / 2) }); $('#client-2 li').on({ 'mouseenter': function() { var scope = this; time = settimeout(function() { var divdom = $(scope).children('div'); var maxwidth = divdom.width(); $(scope).stop().animate({ left: 77-maxwidth}, 'normal', function() { var pic = $(scope).find('.my-kefu-weixin-pic'); if (pic.length > 0) { pic.show(); } }); }, 100) }, 'mouseleave': function() { var pic = $(this).find('.my-kefu-weixin-pic'); var divdom = $(this).children('div'); var maxwidth = divdom.width(); if (pic.length > 0) { pic.hide(); } cleartimeout(time); var divdom = $(this).children('div'); $(this).stop().animate({ left: 0 }, "normal", function() {}); } }); //返回顶部 $(window).scroll(function() { var scrolltop = document.documentelement.scrolltop || window.pageyoffset || document.body.scrolltop; var eltop = $("#client-2").find(".my-kefu-ftop"); if (scrolltop > 0) { eltop.show(); } else { eltop.hide(); } }); $("#client-2").find(".my-kefu-ftop").click(function() { var scrolltop = document.documentelement.scrolltop || window.pageyoffset || document.body.scrolltop; if (scrolltop > 0) { $("html,body").animate({ scrolltop: 0 }, "slow"); } }); });