$(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() { 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"); } }); });