TRYM.CF

Trang chủ | Giải Trí | WapMasTer | Share Code
Thông Báo
[new] Tải App Trym Cho Android Để Đọc Truyện
Trang chủWapMasTerHtml Css
Tìm kiếm | Lượt xem: 727 | Lưu Bài Viết
↓↓

HD tạo hiệu ứng zoom out hình ảnh bằng jquery

Admin* Bm_VQT *
Cách đây 7 năm trước
Hôm nay mình sẽ hướng dẫn các bạn tạo hiệu ứng zoom out hình ảnh bằng jquery. Ý tưởng là hình ảnh sẽ được thu nhỏ lại khi đặt chuột lên hình ảnh đó. Hiệu ứng này thường được sử dụng trong các website về chụp hình hay thư viện hình ảnh để tạo ra một chút hiệu ứng cho sinh động.
*Demo
Đầu tiên chúng ta cần tạo một vài thẻ div để chứa một vài hình ảnh
HTML CODE:
div id="container" class="container">
<div class="wrap">
<a href="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg">
<img src="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg" alt="Picture 1"/>
</a>
</div>
<div class="wrap">
<a href="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg">
<img src="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg" alt="Picture 2"/>
</a>
</div>
<div class="wrap">
<a href="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg">
<img src="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg" alt="Picture 3"/>
</a>
</div>
<div class="wrap">
<a href="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg">
<img src="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg" alt="Picture 4"/>
</a>
</div>
<div class="wrap">
<a href="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg">
<img src="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg" alt="Picture 5"/>
</a>
</div>
<div class="wrap">
<a href="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg">
<img src="http://domain.com/wp-content/uploads/2016/08/3601313864_32fc218bb3_q.jpg" alt="Picture 6"/>
</a>
</div>
</div>

CSS CODE
.wrap{
width:200px;
height:200px;
margin:0px;
overflow:hidden;
position:relative;
float:left;
}
.wrap a img{
border:none;
position:absolute;
top:-66.5px;
left:-150px;
height:500px;
opacity: 0.5;
}

CODE JQERY
$(function() {
$('#container img').hover(
function(){
var $this = $(this);
$this.stop().animate({'opacity':'1.0','height':'200px','top':'0px','left':'0px'});
},
function(){
var $this = $(this);
$this.stop-216.5;
}
);
});
Qua hướng dẫn tạo hiệu ứng zoom out bằng jquery này, hy vọng sẽ giúp các bạn ứng dụng vào những website thực tế. Hẹn gặp các bạn ở những hướng dẫn khác. Cảm ơn các bạn đã theo dõi.
Chia sẻ bài viết ???
- Chia sẻ:G  T  Z
BBCode:

Link:
+ Còn “nhiều” Lắm!
Bạn đã xem chưa?
Trang Chủ[1-727]
Tao.Rất.Yêu.Mày

Old school Swatch Watches