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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.