Love beautiful code? We do too.
.resize(): Ràng buộc một xử lý sự kiện "resize" hoặc kích hoạt sự kiện trên thành phần.
Đã được thêm vào từ phiên bản 1.0
.resize()
$('.test').resize();
.resize(function(){})
$('.test').resize(function(){});
Đã được thêm vào từ phiên bản 1.4.3
.resize("eventData",function(){})
$('.test').resize("eventData",function(){});
Html viết:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Tiêu đề</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function(){
$(window).resize(function() {
$("span").html($(window).width());
});
});
</script>
</head>
<body>
<p>Thay đổi kích thước để thấy được kết quả.</p>
<p>Chiều rộng của window: <span></span>.</p>
</body>
</html>
Hiển thị trình duyệt:
Click để xem kết quả.
Hoclaptrinh.vn © 2017
From Coder With
Unpublished comment
Viết câu trả lời