当把鼠标停留在以上6张图片的任意一张图片的时候,会出现我所说的特效(这里我把鼠标放在第3张作为示例):

Home >Web Front-end >JS Tutorial >jQuery photo resizing effect does not affect the layout of other elements_jquery

jQuery photo resizing effect does not affect the layout of other elements_jquery

WBOY
WBOYOriginal
2016-05-16 16:49:131341browse

I saw this kind of special effect on the Internet before, but unfortunately I didn’t save the URL at the time, so I didn’t know how this special effect was achieved. I deliberately searched the Internet today, and sure enough, I found it.

I also tried hard and tried to write:

But it was just a simple enlargement of the image, and it also affected the layout of the elements around the image (because the enlargement of the image takes up more space).

Later I found that the purpose can be achieved by using the overflow and position attributes flexibly and skillfully. In fact, I think overflow and position (incidentally top, bottom, left, right) in CSS (CSS3) are simply an unsolvable combination for web page special effects. Of course, js (jquery) is the boss.

After talking so much nonsense, everyone must still be confused: What kind of special effect is this? Alas, my language expression ability is still very average. I will take a screenshot to illustrate it below:

This is the initial appearance of the web page when it is opened:
jQuery photo resizing effect does not affect the layout of other elements_jquery
When the mouse is hovering above 6 When you click on any of the pictures, the special effects I mentioned will appear (here I put the mouse on the third picture as an example):
jQuery photo resizing effect does not affect the layout of other elements_jquery
You will find that the picture is shrunk, and when the mouse is placed When you open the picture, it feels like it has been enlarged again (returned to the initial state), without the phenomenon of picture overflow, and it does not affect the layout of other pictures and elements.

The code is posted below:

Copy the code The code is as follows:

< ;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns="http://www.w3.org/1999/xhtml">

jQuery photo scaling effect








< div class="pic">








< /div>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn