Home >Web Front-end >JS Tutorial >A simple javascript image enlargement effect code_image special effects

A simple javascript image enlargement effect code_image special effects

WBOY
WBOYOriginal
2016-05-16 18:21:471654browse

A simple image enlargement effect:
Parameter description:
1.berviary:String, the id of the image that needs to be enlarged
2.expand:object, the enlargement area, if this item or the id of this item is not set If not set, the default is cursor following mode, which will automatically create a div for displaying the magnified area.
3.clip:object, the size of the cropping area, that is, when the mouse moves over the picture that needs to be enlarged, the highlight needs to be Large area
4.opacity:float, the transparency of the masked area of ​​the image when zooming in
Effect 1:

JS code called:

Copy code The code is as follows:

$E({berviary:"currentPic",expand:{id:"expand",style:{ }},clip:{width:"50px",height:"50px"},opacity:"0.2"});

html code:
Copy code The code is as follows:








Demo effect:

[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

Effect 2:
JS code called: Copy code
The code is as follows:

$E({ berviary:"currentPic",clip:{width:"100px",height:"100px"},opacity:"0.4"});

html code: Copy code
The code is as follows:







Demo effect:

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ]
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