Hello! Dear community, I ask for help! Tell me, please, how to launch the modal window, when entering the main page of the site, while you need to send cookies so that the window is not annoying, i.e. if a person has visited a page the window will not show, the lifetime of cookies is 24 hours. I find examples everywhere with the launch of a modal window only by clicking, I am looking badly for the mot ...

Crutch for cookies:

//Отправим печеньку $(function(){ var cookieValue = "true"; $.cookie("visit", cookieValue); $.cookie("the_cookie", "the_value", { expires: 7, path: "/", secure: true }); }); //Получаем печеньку $(function(){ var getCookieValue = $.cookie("visit"); var getThe_value = $.cookie("the_value"); alert("Пользовательская печенька: " + getCookieValue + " " + getThe_value); }); 

    1 answer 1

    In jQuery for this there is a function ready (). It starts after the page is fully loaded.

     jQuery(document).ready(function () {/* А здесь запускай функцию открытия модального окна*/ }) 

    Dock reference

    • Thanks And what ideas about cookies? I gave an example in the question. - Artyomich
    • one
      @ just check if there is a cookie - then the window is no longer open. - lampa
    • one
      Well, what about cookies? You make a check, if there are no your cookies, then you open a modal window and network cookies, and if you have, you do nothing. - SergioVasus
    • Well, I do, make sure of the correctness :) Thank you all! - Artyomich