CSS expression control image automatic scaling effect code [compatible with IE, Firefox]_Experience exchange

WBOY
Release: 2016-05-16 12:04:53
Original
1487 people have browsed it

It took me a long time to finally solve this problem today. It is basically perfect. The only imperfection is that IE 6 will only automatically resize the image after it is completely downloaded. But it is better than nothing. It is better than seeing a long horizontal scroll after entering the page. The article is much more comfortable. Expression is used here, but it is loaded once, so expression will not cause memory leaks. Of course, if you have a better solution, I hope you can communicate with me.

The code is as follows:

.Image { max-width:600px;height:auto;cursor:pointer; border:1px dashed #4E6973;padding: 3px; zoom:expression( function(elm ) { if (elm.width>560) { var oldVW = elm.width; elm.width=560; elm.height = elm.height*(560 /oldVW); } elm.style.zoom = '1'; } (this)); }

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!