jquery-modal
jquery-modal copied to clipboard
Show/hide modals when navigating with back/forward buttons
Using pushState and popState event handlers, we can understand when the modal needs to be closed (and prevents the browser from navigating away), and when the modal needs to be reopened (using the new modal:reopen event).
By default this is turned off, but can be enabled in the modal options
with updateHistory: true
.
Note that as this stands, this doesn't work very well with Turbolinks: I'm not sure yet if this is a bug on the Turbolinks side or not, but in the meantime, this behaviour works for non-Turbolinks sites.
May resolve https://github.com/kylefox/jquery-modal/issues/197
(This PR doesn't update the minified versions, not sure how you do those)
Update: I don't think there's any way to handle Turbolinks + back button correctly, see https://github.com/turbolinks/turbolinks/issues/264
@soundasleep Looks cool, and thanks for also updating the README 🙂
Would you mind adding an example?