Jump to content

Help required about Image Scaling


DarkTerror

Recommended Posts

Hey guyz, Can anyone help me regarding the script which this page uses for photo scaling. See the link please:

http://tinyurl.com/2f64f4

 

I even dont know which language it's using so posted in javascript as i think it to be that. Actually i want to know how the image is scaling to fit the screen after it fully loads and on a mouse click over it it regains it original size.

 

Help!

 

Link to comment
https://forums.phpfreaks.com/topic/67134-help-required-about-image-scaling/
Share on other sites

You're right, it's JavaScript.

 

Try this:

<html>
<head>
<script>
var big=false;
function toggleSize() {
  if(big) {
    document.getElementById('img1').style.width='100px';
    big = !big;
  } else {
    document.getElementById('img1').style.width='1000px';
    big = !big;
  }
}
</script>
</head>

<body>
<img src='myImage.jpg' id='img1' onclick='toggleSize()' width='100'/>
</body>
</html>

 

Replace 'myImage.jpg' with your image url, and set the widths to whatever you want.

 

Hope that helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.