我希望在焦点元素上将边框颜色从灰色渐变到红色。
使颜色缓慢渐变是容易的,但我想让它缓慢地淡入。
HTML
<input class="timeBlock destination hours"
type="text"
name="desHours"
value="00"
maxlength="2">
CSS
input.timeBlock {
height: 90px;
width: 90px;
text-align: center;
font-size: 3.5em;
border-radius: 10px;
color: #444;
border: 3px solid #ccc;
box-shadow: 0px 0px 10px rgba(0,0,0,0.15) inset;
position: absolute;
top:0;
bottom: 0;
margin: auto;
}
input.focus {
border: 3px solid #cc0000;
}
JS
$("input").focus(function() {
$(this).fadeIn('slow', function(){
$(this).addClass('focus');
});
});