Close

Popup

Bizkaze
10 months ago
#21831 Quote
Avatar
  • 2
I have a need for a popup where users can say yes or no to being above 18 years.
Also this popup should be shown whenever a enters the site including from a google link where they might end on a particular product. What widget zone should I use for a popup?

This is the java script - not final version - that roughly has the need functionality.
<script>
function myFunction() {
  var txt;
  if (confirm("Jeg erklærer at jeg er over 18 år i forbindelse med køb af spiritus.")) {
    txt = "Ja, jeg er over 18 år.";
  } else {
    txt = "Jeg er under 18 år.";
  }
}
</script>
todor.atanasov
10 months ago
#21833 Quote
Avatar
  • Moderator
  • 246
Bizkaze wrote:
I have a need for a popup where users can say yes or no to being above 18 years.
Also this popup should be shown whenever a enters the site including from a google link where they might end on a particular product. What widget zone should I use for a popup?

This is the java script - not final version - that roughly has the need functionality.
<script>
function myFunction() {
  var txt;
  if (confirm("Jeg erklærer at jeg er over 18 år i forbindelse med køb af spiritus.")) {
    txt = "Ja, jeg er over 18 år.";
  } else {
    txt = "Jeg er under 18 år.";
  }
}
</script>


Greetings,

You can use any of the widget zones available in the HTML widgets plugin. You can even define your custom widget zone and include it in the SupportedWidgetZones.xml file of our plugin and after a restart, you will see it available.

For scripts that should be active on every page, I assume you can either use head_html_tag or footer depending on your needs.
Best regards,
Todor Atanasov
Nop-templates.com