Is there a way to implement a modal without putting a '#' in the url? When I click the button to open a modal, a '#' is added to the url to open it, but when I close it and I click on the browser's Back button, the modal opens automatically
This has nothing to do with CSS and therefore spectre. An anchor without at least a hash in its href attribute won't react to mouse events. An additional
onclick="event.preventDefault()"
should do the trick.
This has nothing to do with CSS and therefore spectre. An anchor without at least a hash in its href attribute won't react to mouse events. An additional
onclick="event.preventDefault()"
should do the trick.
test:
1 - Access here https://8lab.000webhostapp.com/
2 - Click Open modal
3 - Click the X or the Close button.
4 - Click on the browser's Back button
5 - And Voil谩 !!! The modal opens alone, without me clicking Open Modal
How can resolve this?
Do what I suggested?
This has nothing to do with CSS and therefore spectre. An anchor without at least a hash in its href attribute won't react to mouse events. An additional
onclick="event.preventDefault()"
should do the trick.test:
1 - Access here https://8lab.000webhostapp.com/
2 - Click Open modal
3 - Click the X or the Close button.
4 - Click on the browser's Back button
5 - And Voil谩 !!! The modal opens alone, without me clicking Open ModalHow can resolve this?
Still not a CSS problem, you're creating the modal by appending the #modal-id to the URL, which to the browser means a redirection of some sort, you should be doing that using JS by displaying/hiding it directly on the DOM element.
Otherwise, test what @Vectrex alredy told you to do.
Thanks to all @Vectrex @nodgear, but I solved this... adding and removing the "active" "class" of the element with JS and also added javascript: void (0) Iin the links.
https://8lab.000webhostapp.com/
@alexolliveira happy for you, void(0) has the same result as event.preventDefault() because both of them are running an empty function without returns
You can close the issue yourself afaik