10
6
2011
0

jQuery实现动态可变长度的搜索框

如下js代码,取自:http://bjmun.org/

$(function(){
   $('#s').focus(function() {  //设置获得焦点时的方法,让文本框变长
	$(this).animate({width: "215"}, 300 );	
	$(this).val(''); //用于清空内容,可选操作
   });

   $('#s').blur(function() {  //设置失去焦点时的方法,让文本框变短
	$(this).animate({width: "100"}, 300 );
   });
});
Category: Web摘记 | Tags: javascript jquery | Read Count: 3927

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com