Utilizing the jQuery transit plugin, I am rotating a block element with 4 navigation controls. Each time a nav item is clicked, the block rotates to the specified custom data attribute of that nav item - either 0, 90, 180, or 270 degrees.
While I have successfully achieved this functionality (viewable in my JSFiddle: http://jsfiddle.net/xkdgdhbk/, tested only in Chrome), I now want to restrict the rotation to always go clockwise. Currently, if you click on 180deg it rotates clockwise, but then if you click on 90deg, it goes anti-clockwise. Is there a way to ensure that the element rotates clockwise at all times?
Below is the script from the JSFiddle:
$("span").click(function(){
$(".rotate").transition({ rotate: $(this).attr("data-rotate") + "deg"});
});