I have an element that is draggable via jQuery UI's .draggable()
. How can I make the opacity of that element less as the element is being dragged?
So it looks like it is fading out while being dragged?
I also have revert set to true, and I want it to return to full opacity as and if the revert starts and is happening.
Here is my jQuery code:
$('#draggable').draggable({
axis: 'x',
revert: true,
drag:function(event, ui){
if(ui.position.left>0){
console.log("moving right");
// fade out / make opacity less as drag moves right or ui.position.left becomes higher.
}
}
});
Here is a JS Fiddle with the code: http://jsfiddle.net/EybmN/1/
I am wondering and hoping someone can help me figure out how to gradually fade out / make the opacity less of object being dragged as it is being dragged. But if revert occurs and the item start sliding back to its original place then return the opacity back to full.
I would greatly appreciate any and all help!
Thanks in Advance!