Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using bootstrap modal inside a table but when I scroll deep down at the end of the table and open the modal it works great. But when I close the modal it scrolls the page to the top instead of staying at the particular row.

<button type="button" class="close" data-dismiss="modal" aria-label="Close">


What I have tried:

Tried using
body.modal-open:{
 overflow:visible and overflow:hidden
}
Posted
Updated 24-Feb-22 8:55am

1 solution

Your code does not explain a lot but if I have it correct, the following should work -

The hiding functionality is implemented in the modal.js in this way. In a javascript just do the following -

this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))


Basically it's just finding the elements that have the attribute of data-dismiss and the value of modal. Upon click it will hide these elements.
Play with these to suit your needs.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900