-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popup is not centralize on first click #50
Comments
Do your popup have a width or height? Live example? |
Have the same. |
I have the same problem... what the heck. I use bPopup on every site, for some reason it's completely wacky here. |
I found the problem, it's because the modal didnt have |
I was able to improve the centering of my popup (width: 100vw, height: auto) by:
I did a quick bit of debugging of the bPopup code (spaces+tabs, /cry) and can see the problem is that in the first call to calcPosition(), $popup.outerHeight(true) returns the wrong height (too tall). I'm not sure why this is; I tried adding a setTimeout() in case it was a timing problem, but it doesn't seem to be. If I add $popup.reposition() immediately following the final doTransition(true) in open(), then the popup appears in the correct position, although I think there is still a brief visual jump. Here's a monkey patch which adds the reposition(). It also sets the amsl to zero (which is something I would otherwise do for all my bPopups).
|
hey guys. Do you have a live example? Jsfiddle or similar |
I already said what the problem is |
yes but its the same issue @jogal360 has? |
I would venture to guess it's the same, because I had 100% the same problems as he had, and I tried the same things to fix it, and got the same things. |
I have the same issue, using display:none solve my problem |
Okay guys, @9mm @qingweibinary So your issue was that the popup wasn't centered on first open. And you fixed it by adding display none to the modal. Just as a css rule like this: .b-modal { ? |
Yes that's all. The problem is that the modal needs to be hidden for it to work properly. If you accidentally leave it visible and dont realize it (such as if you have a very long homepage and its at the bottom, outside of the viewable window, shown but hard to notice), then that's when it messes it up. I scrolled to bottom on accident and that's when I realized it was visible to start. Added display none and the problem went away. |
Hmm ok. But the modal is being added when the popup opens. You know there is an option called ´modal´you can set to false. Is it because you're not appending to body? Do yo have a jsfiddle or live example? Or can you post the code for creating bpopup here? Thanks |
I think found the problem.
if $popup is hidden element, $popup.outerHeight(true), $popup.outerWidth(true) is zero. |
add these two lines in the open function. before the "doTransition(true);" calcPosition(); |
popup element inside non-display block, e.g.: |
When I open the popup in the first click is not centralize, after the popup is in the center. How can I resolve it?
The text was updated successfully, but these errors were encountered: