dinbror / bpopup

bPopup is a lightweight jQuery modal popup plugin (only 1.34KB gzipped). It doesn't create or style your popup but provides you with all the logic like centering, modal overlay, events and more. It gives you a lot of opportunities to customize so it will fit your needs.
http://dinbror.dk/bPopup
427 stars 260 forks source link

Allow forcing of reposition() #39

Open pavsid opened 9 years ago

pavsid commented 9 years ago

Might be a good idea to add a 2nd parameter to the reposition() function to allow forcing of reposition, even if the popup isn't completely inside the window. Currently the function will only work if the popup is completely inside the window, which isn't always ideal, when for example, the height of the content of the popup has changed.

E.g. I load the popup and it sits 100px high in the middle of a mobile screen. I then pull in some other content via AJAX and the content is now 700px high, but reposition() won't fire because the popup is taller than the screen of the mobile. So instead, the popup sits in its original position, with its top edge in the middle of the screen and overflows well off the bottom of the screen.

What would be better is if we could force the reposition to fire, after the new content has been loaded, which would then move the popup to the top of the screen at least.