I have an issue with a modal that I programmed. When it is opened or closed, it goes to the top of the page. I want the page background to stay exactly where it is opened and not move. I have it opening with JavaScript and have tried
$("html,body").css("overflow","hidden");
but it does not work. Any other thoughts?
Got it figured out (although not sure if it is the best way). I replaced
<a href="#" onclick="myFunction('function')">Open Modal</a>
with
<a href="javascript:void(0)" onclick="myFunction('function')">Open Modal</a>
I am up for better options if there are.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.