window width #21

pavdro opened this Issue Oct 3, 2013 · 8 comments


None yet

3 participants

pavdro commented Oct 3, 2013

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 commented Nov 26, 2014

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

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) {
debounce = setTimeout(function () {
animateSpeed = animateSpeed || o.followSpeed;
.each(function () {
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 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 commented Dec 15, 2014

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

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 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 commented Dec 23, 2014

hopefully we will get an update sometime.

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 commented Jan 24, 2015

Fixed in v. 0.11.0

@dinbror dinbror closed this Jan 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment