Equal than picture indent horizontally/vertically center native JavaScript effects

Source: Internet
Author: User

Idle, with native JavaScript wrote a fixed width of the div box, and so more than the picture to shrink

Plus Horizontal/Vertical center JavaScript effects, I hope to be useful for your children's shoes, or what should be perfect. 0.0

<script type= "Text/javascript" >

function Showimgh_w2 (TR,QW,QH) {

var sdgh,sdgw,j2;



if (Sdgw>sdgh) {

tr.style.width=qw+ "px";

var Rr=qh;

J2= (qh-(QW/SDGW) *sdgh)/2;

if (j2>0)

tr.style.paddingtop=j2+ "px";



tr.style.height=qh+ "px";

var rr=200;

J2= (qw-(QH/SDGH) *SDGW)/2;

if (j2>0)

tr.style.paddingleft=j2+ "px";





Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.