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

IE bug: dynamic layouts do not properly update the position of placeholder #31

Open
MarcusPope opened this issue Oct 31, 2012 · 2 comments

Comments

@MarcusPope
Copy link

IE requires two changes to fix this problem. First, the resize event needs to be attached to window instead of document. And the second fix is more for performance versus a requirement - but IE will call the resize event repeatedly for virtually every pixel change in the window dimension while the user resizes the browser. Here's the code to avoid that problem:

... //line 157
var timerid = null;

$(window).bind("fontresize resize", function() {             
    if (timerid) clearTimeout(timerid);
    timerid = setTimeout(function() { 
        positionPlaceholder(placeholder,input);            
    }, 500);
});

Not sure if fontresize can be attached to window so you'll want to test that, but the common timerid shouldn't conflict between the two events. You can also get away with adjusting the timeout duration to 250ms if you prefer a faster adjustment after the last pixel adjustment but I think on older systems with higher than normal cpu usage anything below 200 risks running the positionPlaceholder repeatedly.

@ginader
Copy link
Owner

ginader commented Nov 29, 2012

I tried to reproduce the issue you mentioned about IE not triggering the resize on the document. I can't reproduce that though. Don you have a testcase for that? Also: Which Version of jQuery are you using and which IE Version did you have this issue with?

I like your idea of throttling the window resize. I'll look into that.

@nathansamson
Copy link

"IE requires two changes to fix this problem. First, the resize event needs to be attached to window instead of document. "

I am having the same problem. Using jQuery 1.9.1 on IE 8. The Demo site works correctly (but might be using an older jQuery and/or polyfill).

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