Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery图像根据光标的方向旋转_Jquery_Html_Image_Rotation_Image Rotation - Fatal编程技术网

jQuery图像根据光标的方向旋转

jQuery图像根据光标的方向旋转,jquery,html,image,rotation,image-rotation,Jquery,Html,Image,Rotation,Image Rotation,所以我有一个有旋钮的鼠标在上面旋转。不幸的是,它们只是顺时针走。是否有某种方法可以记录光标进入图像的方式(从右侧或左侧),并相应地旋转它?也就是说,如果从左,顺时针旋转,如果从右,逆时针旋转。这将是一个很好的功能。jQuery能很好地处理此类事件吗 $(window).load(function () { $('img.menuimg').rotate({ bind: { mouseover: function () {

所以我有一个有旋钮的鼠标在上面旋转。不幸的是,它们只是顺时针走。是否有某种方法可以记录光标进入图像的方式(从右侧或左侧),并相应地旋转它?也就是说,如果从左,顺时针旋转,如果从右,逆时针旋转。这将是一个很好的功能。jQuery能很好地处理此类事件吗

$(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,
                })
            }
        }
    });
});
供参考:

经过几个月的搜寻。。我遇到了这样一个问题:


这些代码片段应该有助于理解方向意识

你能发布允许旋钮顺时针转动的代码吗?在最新版本的Chrome上,链接上的旋钮甚至对我都不起作用。你应该按照奥斯汀的建议发布你的相关代码哇,我没有通过邮件收到回复。很抱歉代码是:
$(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,})悬停旋钮时,需要检查鼠标的x位置。将x与上一个x进行比较,您可以确定鼠标移动的方向,此时仅对wayLink的答案表示不满。试着把相关的部分添加到你的文章中。哦,对不起!今天晚些时候我会更新一些代码。这个链接正好显示了我的解决方案。