一个会自动伸长的输入框jQuery代码

  • 基于jQuery实现的特效,一个会自动伸长的输入框,当把鼠标移上去的时候,输入框就自动变长,好像已经做好了准备等待您的输入,有点人性化的味道,其实这是用jQuery实现的比较简单动画效果,若有心者,可互相借鉴学习。



点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  2. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  3. <head>
  4. <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
  5. <title>jQuery自动伸长的输入框</title>
  6. <script type=\"text/javascript\" src=\"/ajaxjs/jquery-1.4.2.min.js\"></script>
  7. <style type=\"text/css\">
  8. body
  9. {
  10. margin:0; padding:0; font-size:12px;
  11. }
  12. a:link {
  13. color:#1553a9; text-decoration: none;
  14. }
  15. a:visited {
  16. text-decoration:none; color: #1553a9;
  17. }
  18. a:hover {
  19. text-decoration:none; color: #f46662;
  20. }
  21. a:active {
  22. text-decoration: none; color:#f46662;
  23. }
  24. #main
  25. {
  26. width:500px; margin:0 auto; margin-top:100px;
  27. }

  28. #de
  29. {
  30. display:block;width:100px; height:30px; line-height:30px; float:right; border:#b7b7b7 1px solid; padding-left:5px; border-right:0;
  31. }
  32. #go
  33. {
  34. width:30px; float:right;height:22px; border:#b7b7b7 1px solid; border-left:0; padding-top:10px; padding-left:15px; background-color:#464646; cursor:pointer; color:#FFFFFF;
  35. }
  36. </style>
  37. <script type=\"text/javascript\">
  38. $(function(){

  39. $(\"#de\").mouseover(function(){
  40.     $(\"#de\").animate({\"width\":\"250px\"});
  41. }).mouseout(function(){
  42.     $(\"#de\").animate({\"width\":\"100px\"});
  43. });
  44. });
  45. </script>
  46. </head>
  47. <body>
  48. <div id=\"main\">
  49. <div id=\"ss\"><div id=\"go\"></div><input type=\"text\" id=\"de\"/></div>
  50. </div>
  51. </body>
  52. </html>


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29737856/viewspace-1225160/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29737856/viewspace-1225160/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值