javascriptjqueryhtmlcssjqmodal

Bind the browser scrollbar with modal window ofter it opens


When modal window is opened I want browser's scrollbar to be attached to this modal window so that scrolling will scroll down the modal window and initial page will remain locked. I have seen this in getglue.com. Here are screen shots attached or you can visit the site too.
Original Initial state

Modal window is open now modal window

As you can see the default scroll bar is now binded to modal window and page at background is locked. How this can be achieved ? I am using jqmodal plugin (if it helps).


Solution

  • The effect is achieved by setting appropriate values for the CSS-property overflow-y on the the overlay and its container (see for example this MDN-article).

    Here's an example of how to achieve something similar: http://jsfiddle.net/ZwXdD/