i have been trying to find a way to do it, but i can't seem to think of one. i need to do this:
var animElements = document.getElementById("resizercontainer").getElementsByTagName("p")
for(var i=0; i<animElements.length; i++) {
animElements[i].onmouseover = widthChange;
animElements[i].onmouseout = widthRestore;
}
function widthChange() {
if (!this.currentWidth) this.currentWidth = 150;
doWidthChangeMem(this,this.currentWidth,170,10,10,0.333);
}
function widthRestore() {
if (!this.currentWidth) return;
doWidthChangeMem(this,this.currentWidth,150,10,10,0.5);
}
but i want to use .onclick instead of .onmouseover and .onmouseout
i have come up with this:
var animElements = document.getElementById("both").getElementsByTagName("p");
for(var i=0; i<animElements.length; i++) {
if (currentwidth = 150){animElements[i].onclick = sizeChange;}
else {animElements[i].onclick = sizeRestore;}
}
function sizeChange() {
if (!this.currentWidth) this.currentWidth = 150;//if no mem is set, set it first;
doWidthChangeMem(this,this.currentWidth,170,10,10,0.333);
}
function sizeRestore() {
doWidthChangeMem(this,this.currentWidth,150,10,10,0.5);
}
but i still have not found a way for it to detect if it has been clicked before.
any help would be apreciated