Css/javascript Start Faded Out By Default, Then Fade In
I'm trying to make a button that causes a green check image to fade in then fade out again. It mostly works, but how do I make the check start out in the faded out position when th
Solution 1:
I'd use display:none in css to hide on page load:
#check {
display:none;
}
functiongreen_check(check){ //fade in half a sec, hold 2 sec, fade out in 3 sec
$(check).fadeIn(500, function () {
$(this).delay(2000).fadeOut(3000);
});
}
#check {
display:none;
width:16px;
height:16px;
}
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><buttontype="button"onclick="green_check(getElementById('check'));">Show Check</button><imgclass='five_sec_check'id="check"src='http://neil.computer/s/check.png'/>
Post a Comment for "Css/javascript Start Faded Out By Default, Then Fade In"