I have a box I would like to move around the corners of the window. For that I'm using a jQuery attr function on click which takes the box to said corner by altering the class.
The problem here is that I can't get the div to transition between locations on click. My first guess is that the added classes have the coordinates written with top, bottom, left, right tags whereas the original box's css does not contain such parameters. Thing is that if I add the params, the transition sure works, but the box doesn't go where I'd wish it to go. Play around with the pen and you'll see what I'm talking about.
Here's the css of elements:
#menu {
position: absolute;
background: @c5;
width: 160px;
height: 160px;
-webkit-transition: all 2s; // Chrome
-moz-transition: all 2s; // Mozilla
-o-transition: all 2s; // Opera
transition: all 2s;
overflow: hidden;
border-radius: 50%;
}
.topleft {
top: 0 ;
left: 0;
}
.topright {
top: 0;
right: 0;
}
.bottomleft {
bottom: 0 @I;
left: 0 @I;
}
.bottomright {
bottom: 0 @I;
right: 0 @I;
}
.link {
width: 80px;
height: 80px;
float: left;
}
The jQuery is a simple, on click add alter this or that class
$("#m1").click(function(){
menu.attr('class', 'bottomright');
}); //this times four
You for more details check THE PEN
It's been 5 hours of trying different things out, and now I'm out of ideas. So if anyone has a better clue on how to get this to work, it would be gladly appreciated.
ps. Google didn't help