Hiệu ứng Puff trong jQuery
Miêu tả
Hiệu ứng Puff có thể được sử dụng với show/hide/toggle. Nó Scale và fade out các hiệu ứng tạo ra hiệu ứng puff.
Cú pháp
Sau đây là cú pháp để sử dụng hiệu ứng Puff trong jQuery:
selector.hide|show|toggle( "puff", {arguments}, speed );
Tham số
Chi tiết tham số được sử dụng để tạo hiệu ứng Puff trong jQuery:
mode − Chế độ của hiệu ứng, có thể là "show", "hide". Mặc định là hide.
percent − Phần trăm để scale. Mặc định là 150.
Ví dụ
Sau đây là ví dụ đơn giản minh họa cách sử dụng của hiệu ứng Puff trong jQuery:
<html>
<head>
<title>The jQuery Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#hide").click(function(){
$(".target").hide( "puff", { }, 2000 );
});
$("#show").click(function(){
$(".target").show( "puff", {percent:100}, 2000 );
});
});
</script>
<style>
p {background-color:#bca; width:200px; border:1px solid green;}
div{ width:100px; height:100px; background:red;}
</style>
</head>
<body>
<p>Click on any of the buttons</p>
<button id="hide"> Hide </button>
<button id="show"> Show</button>
<div class="target">
</div>
</body>
</html>
Nó sẽ cho kết quả:
Công cụ giáo viên (2048.VN)
Tạo- trộn đề thi miễn phí từ file PDF, Word, Giao bài nhanh chóng, Hoàn toàn Free
Các bài học jQuery khác tại VietJack:
Dành cho bạn
Công cụ giáo viên
- Tạo đề online từ PDF / Word
- Trộn nhiều mã đề, in Offline
- Giao bài online, Quản lí lớp học

