I have set an opacity to a draggable div, but the problem is that i don’t want to add the opacity on mouse down, only when I start move the div.
Should be connected to the X and Y but i really don’t get how to.
This is what i have.
function startDrag(evt) { // To start the opacity function
this.style.opacity = "0.5";
}
And to stop in och mouse up
function changeClass() {
var diceClass = document.getElementsByClassName("draggble");
for (var i = 0; i < diceClass.length; i++) {
diceClass[i].style.opacity="1";
}
}
jsFiddle
http://jsfiddle.net/dymond/tQdFZ/6/
I moved
this.style.opacity = "0.5";fromstartDragfunction tomoveAlongfunction.Demo