Created
August 20, 2013 18:22
-
-
Save fdaciuk/6285202 to your computer and use it in GitHub Desktop.
Polyfill para placeholder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$formLogin = $( 'form.form-login' ); | |
$formLogin.find( 'label' ).addClass( 'js' ); | |
$formLogin.find( 'input[type=text], input[type=password]' ).each(function(){ | |
// Verifica se os campos estão preenchidos (autocompletar do browser) | |
if( $( this ).val() !== '' ) { | |
$( this ).prev( 'label' ).animate({'font-size' : 0}, 200); | |
} | |
$( this ).focus(function(){ | |
$( this ).animate({boxShadow : '0 0 13px #fc0'}, 300) | |
.prev( 'label' ).animate({'opacity' : '0.5'}, 200); | |
}) | |
$( this ).blur(function(){ | |
$( this ).animate({boxShadow : '0 0 0 #fc0'}, 300) | |
.prev( 'label' ).animate({'opacity' : '1'}, 200); | |
if( $( this ).val() == '' ){ | |
$( this ).prev( 'label' ).animate({'font-size' : '11px'}, 200); | |
} | |
}) | |
$( this ).keypress(function(){ | |
$( this ).prev( 'label' ).animate({'font-size' : 0}, 200); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment