PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, July 26, 2022

[FIXED] How to auto close newsletter popup in shopify after 10-15 seconds?

 July 26, 2022     javascript, jquery, liquid, shopify, shopify-app     No comments   

Issue

I developed a newsletter popup modal in liquid for a Shopify store. I want to make the popup close automatically after 15 seconds whether the user clicks on the close button or not.

Following is the link to my code file: https://textdoc.co/index.php/x6slY3CVRXZFUtrD
Review it live here: https://www.desire4leather.com/


Solution

Trigger a click of .jsclosepoup after a 15 seconds timeout.

Add this javascript snippet at the end of your code file:

{% javascript %}
  function closePopup() {
    $('.jsclosepoup').click()
  }

  var closePopupDelay = 15 * 1000
  setTimeout(closePopup, closePopupDelay)
{% endjavascript %}


Answered By - Jimmy
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing