Guest User

Untitled

a guest
Nov 13th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. $(document).ready(function(){
  2.  
  3. // tooltip
  4.  
  5. $(function () {
  6. $ ('#ADtag').tooltip();
  7. });
  8.  
  9. $(function () {
  10. $('[data-toggle="tooltip"]').tooltip();
  11. });
  12.  
  13.  
  14. //smooth-scrolling
  15.  
  16. var $root = $('html, body');
  17. $('.navbar a').click(function() {
  18. var href = $.attr(this, 'href');
  19. if (href != undefined && href != '#') {
  20. $root.animate({
  21. scrollTop: $(href).offset().top
  22. }, 500, function () {
  23. window.location.hash = href;
  24. });
  25. }
  26. return false;
  27. });
  28.  
  29. //message box
  30.  
  31. $('#message-box').css('background-color','#d0e4e8');
  32.  
  33. $('#message-box').on("keyup", function() {
  34. console.log("keyup happened")
  35. var charCount = $('#message-box').val().length;
  36. console.log(charCount);
  37. $('#char-count').html(charCount);
  38. if(charCount > 50) {
  39. $('#char-count').css('color','red')}
  40. else {
  41. $('#char-count').css('color','blue')
  42. };
  43. });
  44.  
  45.  
  46. //contact submit button action
  47.  
  48. $('#contact-submit-button').on('click', function() {
  49. console.log('clicked');
  50. return false;
  51. });
  52.  
  53. $('#contact-submit-button').on('click', function() {
  54. var comment = $('#message-box').val();
  55. if (comment === ""){
  56. $('#message-box').css('border', '2px solid red');
  57. }
  58. else {
  59. console.log(comment);
  60. $('#visible-comment').html('The following comment has been submitted: ' + comment);
  61. $('#visible-comment').css('text-align', 'center');
  62. $('#visible-comment').css('text-transform','uppercase');
  63. $('#message-box').hide();
  64. $('#contact-name').hide();
  65. $('#contact-email').hide();
  66. return false;
  67. }
  68. });
  69.  
  70. });
Add Comment
Please, Sign In to add comment