Hi
I'm learning how to use Draggable.
I have some divs styled as coloured boxes with some basic text in.
<div id="answer1" class="box-answer"><span class="text">a ratio</span></div>
I use the following Javascript to facilitate the div being Draggable and then to change the colour of the box when it receives an onClick. I'm not sure why, but it doesn't seem to work
Draggable.create(".box-answer", {
type:"x,y",
bounds: "#container",
throwProps:true,
edgeResistance:0.35,
onClick:function() {
console.log("clicked", this.target.id );
$( "#"+this.target.id ).css("background-color","#333333");
},
onDragEnd:function() {
console.log("drag ended");
}
});
If anyone can show me how I change the CSS properties of a Draggable element after receiving a mouseEvent I'd be very grateful.
Many thanks in advance