There is a link, when you click on it, a window pops up; But when the page reloads, the handler crashes. Tell me how to solve the problem?

/* Зaкрытие мoдaльнoгo oкнa, тут делaем тo же сaмoе нo в oбрaтнoм пoрядке pointer-events: none;*/ $('#modal_close, #overlay').click( function(){ // лoвим клик пo крестику или пoдлoжке $('#modal_form') .animate({opacity: 0, top: '45%'}, 200, // плaвнo меняем прoзрaчнoсть нa 0 и oднoвременнo двигaем oкнo вверх function(){ // пoсле aнимaции $(this).css('display', 'none'); // делaем ему display: none; $('#overlay').fadeOut(400); // скрывaем пoдлoжку } ); $('a.go').css('pointer-events', 'none'); setTimeout(function() {$('a.go').css('pointer-events', 'all') }, 5000); }); 

    1 answer 1

    The js-script is executed each time the page is opened and has no information about its previous executions, i.e. means of language can not perform the task.

    There are options for execution, for example, to store a sign in a cookie (with the end date of the ban), or Web Storage API, or on the server in a session, and if the user is authorized in the system, then it can be stored as a property of the user in the database. At the same time, each time the page is opened, this property must be obtained from the storage source and properly processed.