$(document).ready(screenwidth);//获取屏幕尺寸 function screenwidth(){ var resizetimer = null; $(window).bind('resize', function() {//监听窗口resize事件 if (resizetimer) cleartimeout(resizetimer); resizetimer = settimeout(rsize, 100); }); rsize();//初始化 function rsize(){ var _window = $(window); var _w =parseint((_window.width()-1050) / 2); //head line填充宽度 $("#line").css({"width":_w + 1050 + "px"}); //$("#focus").css({"width":_w + 1050 + "px"}); $(".line").css({"width":_w + 1050 + "px"}); $(".banner").css({"width":_w + 1050 + "px"});//对象赋值 }; } $(document).ready(inputtxt);//鼠标经过搜索图标,滑出input function inputtxt(){ var _obj = $(".searchs"), _ochildtxt = _obj.find(".inp-txt"); _obj.on({ click:function(){ $(this).animate({width:126},250); _ochildtxt.animate({width:97},250); }, mouseleave:function(){ $(this).animate({width:106}); _ochildtxt.animate({width:77}); } }); } $(document).ready(function() { $(".btr .wx").hover(function(){ $(".btr .wx div").addclass("swm"); }); $(".btr .wx").on('mouseleave', function () { $(".btr .wx div").removeclass("swm"); }); });