Guest User

Untitled

a guest
Sep 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. //the popup will not show if the user close it by pressing close button. If click then it will not show for certain time.
  2. function showNewsletter(){
  3. //get the data either the close button clicked or not
  4. $('#newsletterclose').click(function(){
  5. $(this).data('clicked', true);
  6. });
  7. //check the cookie and if close button clicked. once both true the popup will not show
  8. if(localStorage.getItem('popNewsletter') != 'active' && !$('#newsletterclose').data('clicked')){
  9. $("#newsletter").addClass(' active');
  10. localStorage.setItem('popNewsletter','active');
  11. }
  12. //if close button clicked the popup will close
  13. $('#newsletterclose').click(function(){
  14. $("#newsletter").removeClass(' active');
  15. });
  16. //use can trigger the popup anytime by clicking the button
  17. $('a[href="#newsletteractive"]').click(function(){
  18. $("#newsletter").addClass(' active');
  19. });
  20. };
Add Comment
Please, Sign In to add comment