I'm trying to figure out how to enable visitors to drag to rotate a 3D div using .draggable(). Currently the div rotates but also moves vertically and horizontally making the process touchy and unpredictable. I would like the origin of the div to stay fixed, and the "dragging" to only affect the rotation, so users can "spin" the div around to see the other sides.
here is link to the codepen: http://codepen.io/armandhammer8/pen/IiBga
$('.anime').draggable({ drag: function(event, ui){
var rotateCSS = 'rotate(' + ui.position.left + 'deg)'; $(this).css({ 'transform': rotateCSS, '-moz-transform': rotateCSS, '-webkit-transform': rotateCSS }); Thanks in advance!
The div element is a little house:
I want to be able to spin it around