Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/placeholder_polyfill.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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/
Expand Down