anseki / jquery-plainmodal

The simple jQuery Plugin for fully customizable modal windows.
http://anseki.github.io/jquery-plainmodal/
MIT License
78 stars 11 forks source link

vertical centring #6

Closed cretace closed 8 years ago

cretace commented 8 years ago

This might be a mistake in my css or html. When I first open the modal window it is not centered vertically - if I resize the window it then centres correctly. I am not adding anything to the init - just $('#mydiv').plainModal('open') Any ideas?

Thanks for nice simple plug in!

anseki commented 8 years ago

Hi cretace, thank you for your post.

So, I have questions:

  1. Which browser (and version) does that problem occur in?
  2. Could you show me your code? (JS, HTML and CSS)
  3. Does that problem occur also in my DEMO page and that browser?
cretace commented 8 years ago

No of course it doesn't appear on your own page! It's the same in FF and Chrome for me But really I just wondered if you had any idea what might cause it.

anseki commented 8 years ago

Thanks for info. So, could you show me your code? If you can't, you can use such as http://jsfiddle.net/ to show sample code.

cretace commented 8 years ago

Ok It seems to have settled down now I was loading text via an ajax call after opening the modal box - I've now moved the open modal to end of the ajax (doh!) Thanks

anseki commented 8 years ago

Ok, I see. :smile: Now, I understand your case. I think that your code changed the size of modal window by adding contents. The information about offset option below will help you. http://anseki.github.io/jquery-plainmodal/#offset The modal window is positioned considering that size at a necessary timing. Therefore if you changed that size after that was positioned, you must fix the position. plainModal provides the way to do that via offset option. Anyway, this issue was solved? and it's closed?