diff --git a/src/placeholder_polyfill.jquery.js b/src/placeholder_polyfill.jquery.js index 81b2287..cfe65d9 100644 --- a/src/placeholder_polyfill.jquery.js +++ b/src/placeholder_polyfill.jquery.js @@ -94,7 +94,7 @@ var input = $(this), text = input.attr('placeholder'), id = input.attr('id'), - label,placeholder,titleNeeded,polyfilled; + label,placeholder,titleNeeded,polyfilled,timerId; function onFocusIn() { if(!o.options.hideOnFocus && window.requestAnimationFrame){ @@ -152,8 +152,11 @@ showPlaceholderIfEmpty(input,o.options); // reformat on window resize and optional reformat on font resize - requires: http://www.tomdeater.com/jquery/onfontresize/ - $(document).bind("fontresize resize", function(){ - positionPlaceholder(placeholder,input); + $(window).bind("fontresize resize", function(){ + if (timerId) clearTimeout(timerId); + timerId = setTimeout(function() { + positionPlaceholder(placeholder,input); + }, 500); }); // optional reformat when a textarea is being resized - requires http://benalman.com/projects/jquery-resize-plugin/