I have a web page with a long list of products. Each product has a link to view product details. Details are displayed in a modal window. The goal is to get the same behavior you might experience when viewing photos on facebook:
- the modal window is displayed at ~ 50px above
- if the height of the modal window is greater than the height of the viewing window than the user can scroll down (the scroll bar now works in the direction of the modal window, and not the page that is in the background).
- When the modal window is closed, the user is in the same position in the product list that was before he opened the modal window.
I am almost there, waiting for the last call. The way I implemented this is to simply open the mod window using JS and then use:
var winH = window.pageYOffset + 50 $('#show_message_overlay').css('top', winH+"px");
to place a modal window.
Feel free to suggest a better approach.
Thanks for any help.
source share