<!DOCTYPE html>
<html>
<head>
<style>
.box,
#btn1,#btn2 { float:left; margin:5px 10px 5px 0; }
.box { width:80px; background:#090; text-align:center; padding:20px 0 20px 0; color:#FFF; font-family:Arial, Helvetica, sans-serif; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<button id="btn1">fade out</button>
<button id="btn2">show</button>
<br>
<br>
<div id="box1" class="box">box1</div>
<script>
$("#btn1").click(function() {
function complete() {
$("<div/>").text(this.id);
}
$("#box1").fadeOut(1600, "linear", complete);
});
$("#btn2").click(function() {
$("#box1").fadeIn(1600);
});
</script>
</body>
</html>
Example :
box1
Tidak ada komentar:
Posting Komentar
Leave a message