V
V
Vladimir2017-03-03 15:13:47
JavaScript
Vladimir, 2017-03-03 15:13:47

How to implement the opening of the form when entering the site?

I have fancy box

jQuery(document).ready(function() {
     jQuery('.popul_item').click(function () {
        jQuery(this).parents('form').submit();
    });
  jQuery.fancybox.open({ 
    padding : [0, 0, 20, 0],
      helpers: {
        overlay: {
          locked: false
        }
      },
      wrapCSS : "fancy--rajon",
      href: "#sel--rajon"
  });

When you enter the site, a pop-up opens with a choice of area. The content of the site depends on the region.
But when I choose The page refreshes and the popup opens again.
How can I make it open only once when I first visit the site?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem, 2017-03-03
Portev @Vladimir Portev

You need to write the flag to the cookie or localStorage (preferably a cookie) and check for its presence every time you visit the page. If there is a flag, we do not show the window, if not, we show it.

P
profesor08, 2017-03-03
@profesor08

Set the cookie and check it, if there is then do not show the window.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question