Closed pavdro closed 9 years ago
Same Issue as #7 . Anyone managed to find a fix?
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); //} };
Hey pavdro,
seems to not work for me. The popup is still slightly off to the right when the scrollbar is visible.
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.
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.
GJ! hopefully we will get an update sometime.
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.
Fixed in v. 0.11.0
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