Reputation: 4212
$("SomeInputField").keydown(function () {
$("SomeDiv").css("top", "30px");
});
First this is making a div go 30px from the top
$("SomeInputField").bind("keyup", function () {
$(this).val() == "" && $("SomeDiv").css("top", "15px");
});
Second, this is making the div go up 15px.
My question: How can I make the div in the second code go up "smoothly", so not "instant" but with some sort of slide up(15px) event.
Upvotes: 0
Views: 161
Reputation: 1265
you can use the .animate() jquery function
http://api.jquery.com/animate/
$("SomeDiv").animate({top: 15}, 1000);
you can adjust the 1000 to adjust the speed
Upvotes: 1