Guest User

Untitled

a guest
Dec 13th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. // Download Button JavaScript Document
  2.  
  3. jQuery(document).ready(function() {
  4. var brochureHeight = jQuery('.brochure_list').height();
  5. var list1open = false;
  6. var list2open = false;
  7. // Hide the dropdown
  8. jQuery('.brochure_list').height(0).css('display', 'none');
  9. jQuery('.brochure_list1').height(0).css('display', 'none');
  10.  
  11. // Put hand there for hover
  12. jQuery('.download_brochure').css({cursor: 'pointer'});
  13. // On click event
  14. jQuery('.download_brochure').click(function() {
  15. jQuery(this).css('backgroundPosition','-326px 0');
  16. var height = brochureHeight;
  17. if (list1open)
  18. {
  19. height = 0;
  20. list1open = false;
  21. } else
  22. {
  23. list1open = true;
  24. }
  25. jQuery('.brochure_list').css('display','block').animate({
  26. height: height
  27. }, 350, function() {
  28. // Animation complete.
  29. if (!list1open)
  30. jQuery('.brochure_list').css('display','none');
  31. });
  32. return false;
  33.  
  34. });
  35.  
  36. jQuery('body').click(function(){
  37. if (list1open)
  38. {
  39. jQuery('.brochure_list').animate({
  40. height: 0
  41. }, 350, function() {
  42. // Animation complete.
  43. jQuery('.brochure_list').css('display', 'none');
  44.  
  45. });
  46. list1open = false;
  47. jQuery('.download_brochure',this).css('backgroundPosition','0px 0px');
  48. }
  49.  
  50. if (list2open)
  51. {
  52. jQuery('.brochure_list1').animate({
  53. height: 0
  54. }, 350, function() {
  55. // Animation complete.
  56. jQuery('.brochure_list1').css('display', 'none');
  57. });
  58. list2open = false;
  59. }
  60. });
  61.  
  62. // Put hand there for click
  63. jQuery('.download_brochure1').css({cursor: 'pointer'});
  64. // On click event
  65. jQuery('.download_brochure1').click(function() {
  66. jQuery(this).css('backgroundPosition','-326px 0');
  67. height = brochureHeight;
  68. if (list2open)
  69. {
  70. height = 0;
  71. list2open = false;
  72. jQuery('.download_brochure1',this).css('backgroundPosition','0px 0px');
  73. } else
  74. {
  75. list2open = true;
  76. }
  77. jQuery('.brochure_list1').css('display','block').animate({
  78. height: height
  79. }, 350, function() {
  80. // Animation complete.
  81. if (!list2open)
  82. jQuery('.brochure_list1').css('display','none');
  83. });
  84. return false;
  85. });
  86.  
  87.  
  88. // Close Doc Ready
  89. });
Add Comment
Please, Sign In to add comment