It depends on what events are taking place. Try using the click event:
$(function () {
* {font-family: 'Segoe UI'; margin: 5px;} #eventContainer, #eventAffected {background-color: #ccf; text-align: center; padding: 5px;} #eventAffected {background-color: #cfc;}
<script src="https://code.jquery.com/jquery-1.9.1.js"></script> <div id="eventContainer">Hello I am the Event Box</div> <div id="eventAffected">Hello, I change when event triggered on the above.</div> <button id="hide-container">Hide</button> <button id="trigger-event">Trigger Click</button>
Test tests
- Click on the first div. . Second Div change, the event fires.
- Click the Trigger Click button. Second Div change, the event fires.
- Click the "Hide and Run Trigger" button. Second Div change, the event fires.
Conclusion
Regardless of whether the DOM element is displayed on-screen or off-screen, all events and behavior are preserved. Only the CSS screen is changed. Nothing else, nothing related to behavior.
This is similar to all events, only that you cannot calculate the size or model of the window.
So this shows that events are saved when there visibility: hidden or display: none .
Praveen kumar
source share