Chase Milhorn Chase Milhorn - 16 days ago 5
CSS Question

What languages should I use to allow users to increase or decrease an image size on a webpage?

I am interested in having +/- buttons to increase and decrease the size of an image. What programming languages could I use, and what would be the pros/cons for using each one? I apologize for my incredibly novice questions.

Answer

Bored, so I decided to build this simple stuff for ya! Please buy be a beer. HTML:

    <img src="http://camcimcumcem.com/tphotos/5001_10000/Square-4.jpg"><br>
    <span id="plus">+</span><br>
    <span id="minus">-</span>

Script:

$("#plus").click(function(){
    $("img").css({"height": "+=50px", "width": "+=50px"});
})

$("#minus").click(function(){
    $("img").css({"height": "-=50px", "width": "-=50px"});
})

DEMO

Comments