Skip to content
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

window width #21

Closed
pavdro opened this issue Oct 3, 2013 · 8 comments
Closed

window width #21

pavdro opened this issue Oct 3, 2013 · 8 comments

Comments

@pavdro
Copy link

pavdro commented Oct 3, 2013

Hi,
in the code you are using 'y.innerWidth || d.width()' which return different values when scrollbar is on the page.

so popup doesn't end up perfectly centered.

Tested with:
jQuery 1.10.2
FF - 24.0

@Joshdw
Copy link

Joshdw commented Nov 26, 2014

Same Issue as #7 . Anyone managed to find a fix?

@pavdro
Copy link
Author

pavdro commented Dec 11, 2014

I've changed some code in the script and works for me.

find reposition funciton
function reposition(animateSpeed) {
wH = windowHeight();
wW = windowWidth();
inside = insideWindow();
//if (inside) {
clearTimeout(debounce);
debounce = setTimeout(function () {
calcPosition();
animateSpeed = animateSpeed || o.followSpeed;
$popup
.dequeue()
.each(function () {
$(this).css({
left: getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)),
top: getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle))
});

//// if (fixedPosStyle) {
//// $(this).css({ 'left': hPos, 'top': vPos });
//// }
//// else {
//// $(this).animate({ 'left': o.follow[0] ? getLeftPos(true) : 'auto', 'top': o.follow[1] ? getTopPos(true) : 'auto' }, animateSpeed, o.followEasing);
//// }
});
}, 50);
//}
};

@Joshdw
Copy link

Joshdw commented Dec 12, 2014

Hey pavdro,

seems to not work for me. The popup is still slightly off to the right when the scrollbar is visible.

@pavdro
Copy link
Author

pavdro commented Dec 15, 2014

Hmm, actually I think that's another bug I've tried to fix.
Apologies.

I think the way I have worked around the center issue is this:
I've attached it to a centered container, so it stays within it and never moves.

@Joshdw
Copy link

Joshdw commented Dec 21, 2014

For anyone else interested, I have a temporary (yet somewhat ugly) solution which is adding this event to the popup's onOpen event:

onOpen: function() { $(this).bPopup().reposition(0); }

That and the code from pavdro seems to fix positioning errors on load. It's a shame this script isn't getting updated much anymore.

@pavdro
Copy link
Author

pavdro commented Dec 23, 2014

GJ!
hopefully we will get an update sometime.

@dinbror
Copy link
Owner

dinbror commented Dec 27, 2014

Try to change the windowWidth and windowHeight funtions to return the fallback value everytime:

function windowWidth(){
return $w.width();
};

I'll be sending out an update in near future.

@dinbror
Copy link
Owner

dinbror commented Jan 24, 2015

Fixed in v. 0.11.0

@dinbror dinbror closed this as completed Jan 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants