JQuery's DIV_javascript technique for loading images with a fixed size

Source: Internet
Author: User
Place an image in a div with a fixed size. When the image size is small, the image automatically adapts to the div size when the image size exceeds the div size. The implementation idea is as follows, if you are interested, you can learn how to place an image in the fixed size p. When the image size is small, the actual size is displayed. When the image size is larger than p, the image automatically adapts to the size of p.

The main code of jquery Image Adaptive size implementation process:

The Code is as follows:

The Code is as follows:


. PImg {
Max-height: 200px; max-width: 200px;
Width: expression (this. width> 200 & this. width> this. height? 200: auto );
Height: expression (this. height> 200? 200: auto );
}


Instance:

The Code is as follows:

The Code is as follows:






Adaptive image loading

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.