Home > Web Front-end > JS Tutorial > body text

JQuery loading image adaptive fixed size DIV_javascript technique

WBOY
Release: 2016-05-16 17:22:54
Original
1182 people have browsed it

How to place an image in a fixed-size div. When the image is smaller, the actual size is displayed. When the image exceeds the size of the div, the image automatically adapts to the size of the div.

The main code for the jquery image adaptive size implementation process :

The code is as follows:

Copy the 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:

The code is as follows:
Copy code The code is as follows:





Implement adaptive image loading
< ;script type="text/javascript" src="../jquery.min.js">


< ;/head>









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