图片自动缩放

Css代码 
<style>
.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));
}
</style>

 

Html代码
<IMG SRC=”test.jpg” WIDTH=”990″ HEIGHT=”2000″ BORDER=”0″ ALT=”” class=”Image”>

This entry was posted in Computer, javascript. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s