Dashboard sipadu mbip
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

popup-menu-form.js 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. $(document).ready(function() {
  2. /***************************************/
  3. /* Popup menu forms */
  4. /***************************************/
  5. // If user clicks on the 'subscribe' item
  6. // Open popup-menu subscribe form
  7. $('#sub-popup-menu').on('click', function() {
  8. if ($('#sub-popup-menu .popup-list-wrapper').css('display') == 'none') {
  9. $('#sub-popup-menu .popup-list-wrapper').css({
  10. display: 'block',
  11. left: 'auto',
  12. right: '0',
  13. opacity: '1'
  14. });
  15. }
  16. });
  17. // If user clicks on the 'login' item
  18. // Open popup-menu login form
  19. $('#log-popup-menu').on('click', function() {
  20. if ($('#log-popup-menu .popup-list-wrapper').css('display') == 'none') {
  21. $('#log-popup-menu .popup-list-wrapper').css({
  22. display: 'block',
  23. left: 'auto',
  24. right: '0',
  25. opacity: '1'
  26. });
  27. }
  28. });
  29. // If user clicks on the 'registration' item
  30. // Open popup-menu registration form
  31. $('#reg-popup-menu').on('click', function() {
  32. if ($('#reg-popup-menu .popup-list-wrapper').css('display') == 'none') {
  33. $('#reg-popup-menu .popup-list-wrapper').css({
  34. display: 'block',
  35. left: 'auto',
  36. right: '0',
  37. opacity: '1'
  38. });
  39. }
  40. });
  41. // Add an event listener
  42. // If user clicks outside a form
  43. // The form will disappear
  44. $(document).on('click touchstart', function(event) {
  45. // Close popup-menu 'subscribe' form
  46. if (!$(event.target).closest('#sub-popup-menu').length) {
  47. if ($('#sub-popup-menu .popup-list-wrapper').css('display') == 'block') {
  48. $('#sub-popup-menu .popup-list-wrapper').css({
  49. display: 'none',
  50. left: '-9999px',
  51. opacity: '0'
  52. });
  53. }
  54. }
  55. // Close popup-menu 'login' form
  56. if (!$(event.target).closest('#log-popup-menu').length) {
  57. if ($('#log-popup-menu .popup-list-wrapper').css('display') == 'block') {
  58. $('#log-popup-menu .popup-list-wrapper').css({
  59. display: 'none',
  60. left: '-9999px',
  61. opacity: '0'
  62. });
  63. }
  64. }
  65. // Close popup-menu 'registration' form
  66. if (!$(event.target).closest('#reg-popup-menu').length) {
  67. if ($('#reg-popup-menu .popup-list-wrapper').css('display') == 'block') {
  68. $('#reg-popup-menu .popup-list-wrapper').css({
  69. display: 'none',
  70. left: '-9999px',
  71. opacity: '0'
  72. });
  73. }
  74. }
  75. });
  76. /***************************************/
  77. /* end popup menu forms */
  78. /***************************************/
  79. });