Is it possible to have an url like this:
www.url.com/#imprint
(or similar) to link directly to the page with the opened modal window?
is this possible? Any hints?
Thank you!
You might be able to do something like this.
if (window.location.hash == "#imprint") {
$('#myModal').modal('show');
}
Just for future visitors/readers, I have created a very simple function to open a modal dynamically without the need to know the exact ID that you're looking for. It just falls through if no hash is located.
/**
* Function to open a bootstrap modal based on ID
* @param int
*/
function directLinkModal(hash) {
$(hash).modal('show');
}
/**
* Call the function on window load
* @param hash of the window
*/
directLinkModal(window.location.hash);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With