6) Growing Image: Start with the image, any one you want with the height or widt
ID: 3749553 • Letter: 6
Question
6) Growing Image: Start with the image, any one you want with the height or width of somewhere near 60 pixels. Each time the picture is clicked, grow it by in a manner appropriate for your picture of choice, somewhere near 5 and/or 10 pixels for width and/or height. If the picture is in landscape, increase width more than height for example. Growth size is up to you. Picture selection is up to you. This screenshot show a picture after 20 clicks on the image.
any image is ok, please show the code with JS
Using JavaScript to Cha O1 Caleulater 1 HideShow 21 Change 7 Styles 31 Move Text 4) Add to Array 51 Cver Out 61 Growing Image 1 Pixel Increase 81 Running Sum 91 Slack Changes Click the image to see it grow.Explanation / Answer
Hi, Please find below my solution to your problem -
<!DOCTYPE html>
<html>
<body>
<img id="myImage" src="pic_bulboff.gif">
</body>
<script>
function resizeImage(){
var myImg = document.getElementById("myImage");
var currWidth = myImg.clientWidth;
if(currWidth == 500){
alert("Maximum zoom-in level reached.");
} else{
myImg.style.width = (currWidth + 50) + "px";
alert(currWidth);
}
}
</script>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.