screen resize bug fix

10 views
Skip to first unread message

Dan

unread,
Sep 7, 2010, 2:08:56 AM9/7/10
to jixedbar
hey everybody,

for some reason or other when I would resize the page, the
jixedbar div would no longer be centered, and would float to the
right. it worked fine in the demo package however, so i first tried
eliminating all non-essential JS and CSS to rule out the source of the
problem, but to no avail...

I didn't feel like going thru 100,000 lines of code, so I wound
up just rearranging some code and creating a different resize event
handler that worked outside the jixedbar function. if anyone else has
the same problem, this might be of use to you.

all I did was remove the window resize event handler from line 30 of
jixedbar.js and append this function to the very end of the file:

function doSomething() {
var screen=jQuery(this);
var screenWidth=screen.width();
var centerScreen=(screenWidth/2)*(1);
var marginLeft=centerScreen-($(obj).width()/2);$(obj).css({"margin-
left":marginLeft});
};
var resizeTimer = null;
$(window).bind('resize', function() {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(doSomething, 1);
});


all the best,
dan popp


PS: wonderful project you have here, great work! and thank you very
much!!


Dan

unread,
Sep 7, 2010, 2:16:49 AM9/7/10
to jixedbar
if you are using fixed-width toolbar, simply removing this:

$(window).resize(function(){var screen=jQuery(this);var
screenWidth=screen.width();var centerScreen=(screenWidth/2)*(1);var
marginLeft=centerScreen-($(obj).width()/2);$(obj).css({"margin-
left":marginLeft});});

from line 30 seemed to take care of the issue
Reply all
Reply to author
Forward
0 new messages