Guest User

Untitled

a guest
Sep 21st, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // Auto-selection when clicked
  2. $(".comment_box").click(function() {
  3. $(".comment_box").css('color', 'black');
  4. });
  5.  
  6. // Text turns gray again when not typing
  7. $(".comment_box").blur(function() {
  8. $(".comment_box").css('color', '#7A7A7A');
  9. });
  10.  
  11. // Post a comment... dissapears when field is clicked
  12. $('.comment_box').focus(function() {
  13. if ($(this).val() === 'Post a comment...') {
  14. return $(this).val('');
  15. }
  16. });
  17.  
  18. // Post a comment... reappears when field is not in focus anymore
  19. $('.comment_box').blur(function() {
  20. if ($(this).val() === '') {
  21. return $(this).val('Post a comment...');
  22. }
  23. });
  24.  
  25. // Expanding
  26. $(".comment_box").focus(function() {
  27. $(this).animate({ width: "470px" }, 250);
  28. $(this).animate({ height: "200px" }, 250);
  29. });
  30.  
  31. $(".comment_box").blur(function() {
  32. $(this).animate({ width: "300px" }, 200);
  33. $(this).animate({ height: "130px" }, 200);
  34. });​
Add Comment
Please, Sign In to add comment