I am trying to create a function in which #div will be tilted 15 degrees to the left per click, and then return to the previous position soon, but I think this can be easily added to the solution with the addition of a Sync Event. But Tilt is what I came across. Ideally, I would only do this with JavaScript; but will be open to jQuery and / or CSS3.
I used the snippet below when creating a custom shake.
jQuery.fn.shake = function() { this.each(function(i) { $(this).css({ "position" : "relative" }); for (var x = 1; x <= 3; x++) { $(this).animate({ left: -15 }, 10).animate({ left: 0 }, 50).animate({ left: 15 }, 10).animate({ left: 0 }, 20); } }); return this; }
But this does not allow; or I didnβt have such luck - creating the βTILTβ effect, only horizontal or vertical side-to-side effect. I guess I might need CSS3. Any pointers?
DISCLAIMER: I hope for a solution to the core JavaScript; since I support IE 9 + / Modern browsers (chrome, ff, safari). Otherwise, at the moment there is no real possibility of implementation. Thanks.
source share