CSS expression controls the image auto scaling effect code [compatible with IE, Firefox]

Source: Internet
Author: User

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

CodeAs 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 Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.