Reputation: 579
our customer ordered a simple html one pager website.
the imprint and data protection contents are in the main HTML file and are shown in a modal box.
the modal box is hidden by default and pops up when you click imprint/dataprotection buttons in the footer.
now the customer needed another page and wants to link the imprint and dataprotection there too, but i cant say "open link AND then open modal", right?
is there a possibility to achieve this which i am overlooking?
Upvotes: 1
Views: 77
Reputation: 1442
I think I have a solution to your problem.
Suppose main.html
holds the imprint, data protection and here the modal shows up with the function showModal()
(For example).
ohter.html
then holds the some simple info.
You can "call" the function showModal
on main.html
by passing a hash (#
) with the url and then checking on main.html
if that hash is available and then call the function.
It would look something like this:
some html content...
<a href="/main.html#showModal">See your info</a>
...
<script>
window.onload = function() {
if(window.location.hash == "#showModal") {
showModal();
}
}
</script>
Hope this gives you an idea of how you could implement such behaviour. If this wasn't of help, please comment.
Upvotes: 2