0

So i have an oven that has knobs that rotate on mouse over. They unfortunately only go clockwise. Is there some way i can log which way the cursor enters the image, from the right or left and rotate it accordingly? I.E if from left, rotate clockwise, if from right, rotate anti-clockwise. That would make a nice feature. does jQuery handle such events well?

$(window).load(function () {
    $('img.menuimg').rotate({
        bind: {
            mouseover: function () {
                $(this).rotate({
                    center: ["50%", "68%"],
                    animateTo: 100,
                })
            },
            mouseout: function () {
                $(this).rotate({
                    center: ["50%", "68%"],
                    animateTo: 0,
                })
            }
        }
    });
});
Huangism
  • 16,278
  • 7
  • 48
  • 74
Rygo
  • 159
  • 1
  • 8
  • Can you post the code that allows the knobs to turn clockwise? – Austen Jul 29 '13 at 22:40
  • The knobs on the link don't even work for me on the latest version of Chrome. You should post your relevant code as Austen suggested – Zach Saucier Aug 15 '13 at 15:40
  • woah, i didnt get my replies by mail. Sorry.. the code is: – Rygo Dec 05 '13 at 21:14
  • `$(window).load(function(){ $('img.menuimg').rotate({ bind: { mouseover : function() { $(this).rotate({ center: ["50%", "68%"], animateTo:100, })}, mouseout : function() { $(this).rotate({ center: ["50%", "68%"], animateTo:0, }) } } }); });` – Rygo Dec 05 '13 at 21:15
  • you will need to check the x position of the mouse when hovering the knobs. Compare the x with the previous x, you can figure out which way the mouse is moving that way – Huangism Dec 19 '13 at 20:26

1 Answers1

0

FOR REFERENCE:

After months of searching.. i came across this:

http://tympanus.net/TipsTricks/DirectionAwareHoverEffect/

The snippets should help figure out direction awareness

ryan
  • 16
  • Link only answers are frowned upon here at SO. Try taking the relevant bits and adding them in context to your post. – crthompson Dec 19 '13 at 20:36
  • Oh I'm sorry! I will update some code later on today. that link just shows my solution exactly. – Rygo May 29 '14 at 10:44