If you can help me with this question I would like to click on a div that is fixed on the rod and it increases and then click again and it decreases, how do I do that?
If you can help me with this question I would like to click on a div that is fixed on the rod and it increases and then click again and it decreases, how do I do that?
You should include some of the code you tried to do, but here's a simple example to give you at least an idea how to get started:
HTML:
<div id="div"></div>
CSS:
#div {
height: 100px;
width: 100px;
background-color: red;
}
Javascript:
var big = true;
$('#div').click(function() {
if(big) {
big = false;
$(this).css('height', '50px');
$(this).css('width', '50px');
} else {
big = true;
$(this).css('height', '100px');
$(this).css('width', '100px');
}
});
Javascript using Animation:
var big = true;
$('#div').click(function() {
if(big) {
big = false;
$(this).animate({
height : "50px",
width : "50px"
}, 1000);
} else {
big = true;
$(this).animate({
height : "100px",
width : "100px"
}, 1000);
}
});
To see live: link
As I said, very simple, to help you as a beginner.