Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(function() {
  3. $('button.expand').click(function() {
  4. $('#test').width(0).show().animate({width: 180}, 500);
  5. });
  6. $('html').click(function() {
  7. $('#test').width(180).show().animate({width: 0}, 500);
  8. });
  9. });
  10. </script>
  11.  
  12. <nav id="menu">
  13. <ul>
  14.  
  15. <li><a href="Home.html">Home</a></li>
  16. <li><a href="About.html">About</a></li>
  17.  
  18.  
  19. <li>
  20. <div id="search-container">
  21. <span id="search" >
  22. <form name="form1" >
  23. <input id="test" type="search" placeholder="Search..." required="required" onfocus="if(this.placeholder == 'Search...') {this.placeholder=''}" onblur="if(this.placeholder == ''){this.placeholder ='Search...'}" />
  24. <button class="expand" type="submit"><i class="fa fa-search"></i></button>
  25. </form>
  26. </span>
  27. </div>
  28. </li>
  29. </ul>
  30. </nav>
  31.  
  32. .form-container input {display:none;}
  33.  
  34. $(function() {
  35. $('button.expand').click(function() {
  36. $('#test').width(0).show().animate({width: 180}, 500);
  37. $('#test').addClass("visible");
  38. });
  39. $('html').click(function() {
  40. if($('#test').hasClass("visible")){
  41. $('#test').width(180).show().animate({width: 0}, 500).removeClass("visible");
  42. }
  43. });
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement