So I have created an draggable div, that I want to be on top the other divs when dragging around it on the content.
I have tried style.zindex=1 but it don't seem to solve the problem, If I do it with Jquery there is no problem, but I want to solve it by JavaScript.
Any tips ?
This is what i have come up with.
function changeClass() {
var diceClass = document.getElementsByClassName("window");
for(var i = 0; i<diceClass.length; i++){
var z = 10;
diceClass[i].style.zIndex=z++;
console.log(diceClass)
}
}
changeClass()
And my Css
.window
{
width : 342px;
height : 182px;
top : 0px;
left : 0px;
position : absolute;
background : url(window.png) no-repeat;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
user-select: none;
cursor: default;
}
I created an jsFiddle. The code is on row 31 - 42