Home > Web Front-end > JS Tutorial > The main implementation code for loading image adaptive size in jquery_jquery

The main implementation code for loading image adaptive size in jquery_jquery

WBOY
Release: 2016-05-16 17:24:28
Original
784 people have browsed it

How to place a picture in a fixed-size div. When the picture is smaller, the actual size is displayed. When the picture exceeds the size of the div, the picture automatically adapts to the size of the div
The main code of the implementation process:

Copy code The code is as follows:

.divImg{
max-height:200px; max-width: 200px;
width: expression(this.width > 200 && this.width > this.height ? 200 : auto);
height: expression(this.height > 200 ? 200 : auto);
}

Example:
Copy code The code is as follows:





Implement adaptive image loading











< ;/html>
Related labels:
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