Javascript JQuery rotate-在chrome中重新启动旋转

Javascript JQuery rotate-在chrome中重新启动旋转,javascript,jquery,google-chrome,Javascript,Jquery,Google Chrome,我有一个圆形图像,在页面加载时旋转,在鼠标经过/移出时停止和开始。这个圆也是可以拖动的,所以我可以手动旋转它。这一切在Mozilla中都可以很好地工作,但在Chrome中却不能很好地工作。问题是它不会重新启动rotateCrolle()在鼠标上。有人能帮忙找出原因吗?为此,我使用了jQueryRotate和Greensock Draggable $(function() { var angle = 0; var int; rotateCircle(); fun

我有一个圆形图像,在页面加载时旋转,在鼠标经过/移出时停止和开始。这个圆也是可以拖动的,所以我可以手动旋转它。这一切在Mozilla中都可以很好地工作,但在Chrome中却不能很好地工作。问题是它不会重新启动
rotateCrolle()在鼠标上。有人能帮忙找出原因吗?为此,我使用了
jQueryRotate
Greensock Draggable

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
$(函数(){
var角=0;
var-int;
旋转圆();
函数rotateCille(){
int=setInterval(函数(){
角度+=3;
$(“#圆”)。旋转(角度);
}, 100);
}           
$(“#圆”).mouseover(函数(){
清除间隔(int);
创建(“#圆”{type:“rotation”,throwProps:true});
}).mouseout(函数(){
旋转圆();
});
});

更简单的方法是向GreenSock Dragable类添加rotateBy方法

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
以下是更新的可拖动类:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
我只在Draggable.js中添加了以下方法:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
this.rotateBy = function(amount) {
    self.rotation += amount;
    self.x = self.rotation;
    dirty = true;
    render();
}
以下是使用新的Dragable类在chrome和ff上工作的JSFIDLE:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

更简单的方法是向GreenSock Dragable类添加rotateBy方法

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
以下是更新的可拖动类:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
我只在Draggable.js中添加了以下方法:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
this.rotateBy = function(amount) {
    self.rotation += amount;
    self.x = self.rotation;
    dirty = true;
    render();
}
以下是使用新的Dragable类在chrome和ff上工作的JSFIDLE:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

更简单的方法是向GreenSock Dragable类添加rotateBy方法

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
以下是更新的可拖动类:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
我只在Draggable.js中添加了以下方法:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
this.rotateBy = function(amount) {
    self.rotation += amount;
    self.x = self.rotation;
    dirty = true;
    render();
}
以下是使用新的Dragable类在chrome和ff上工作的JSFIDLE:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

更简单的方法是向GreenSock Dragable类添加rotateBy方法

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
以下是更新的可拖动类:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
我只在Draggable.js中添加了以下方法:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
this.rotateBy = function(amount) {
    self.rotation += amount;
    self.x = self.rotation;
    dirty = true;
    render();
}
以下是使用新的Dragable类在chrome和ff上工作的JSFIDLE:

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

我不太明白为什么这需要Javascript

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
(仅适用于chrome,为FX等添加供应商前缀)

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

这应该是完全相同的吗?

我不太明白为什么需要Javascript来实现这一点

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
(仅适用于chrome,为FX等添加供应商前缀)

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

这应该是完全相同的吗?

我不太明白为什么需要Javascript来实现这一点

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
(仅适用于chrome,为FX等添加供应商前缀)

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>

这应该是完全相同的吗?

我不太明白为什么需要Javascript来实现这一点

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>
(仅适用于chrome,为FX等添加供应商前缀)

$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>


这应该是完全相同的?

这主要是因为您使用了两个库来旋转相同的元素,所以在chrome GreenSock中使用css3转换属性,而jQuery rotate使用-webkit转换属性。好的。有什么解决办法吗?我需要这两个库,因为它们都做不同的事情。Thanksher介绍了我是如何使用jquery transit、vector math和livescript实现的,这些工具非常有效,但对我来说非常先进。如果我不理解它,我就不能真正使用它,如果可能的话,我更愿意找到一个解决方案,让上面的内容一起工作。无论如何,谢谢。这主要是因为您使用了两个库来旋转相同的元素,所以在chrome GreenSock中使用css3转换属性,而jQuery rotate使用-webkit转换属性。有什么解决办法吗?我需要这两个库,因为它们都做不同的事情。Thanksher介绍了我是如何使用jquery transit、vector math和livescript实现的,这些工具非常有效,但对我来说非常先进。如果我不理解它,我就不能真正使用它,如果可能的话,我更愿意找到一个解决方案,让上面的内容一起工作。无论如何,谢谢。这主要是因为您使用了两个库来旋转相同的元素,所以在chrome GreenSock中使用css3转换属性,而jQuery rotate使用-webkit转换属性。有什么解决办法吗?我需要这两个库,因为它们都做不同的事情。Thanksher介绍了我是如何使用jquery transit、vector math和livescript实现的,这些工具非常有效,但对我来说非常先进。如果我不理解它,我就不能真正使用它,如果可能的话,我更愿意找到一个解决方案,让上面的内容一起工作。无论如何,谢谢。这主要是因为您使用了两个库来旋转相同的元素,所以在chrome GreenSock中使用css3转换属性,而jQuery rotate使用-webkit转换属性。有什么解决办法吗?我需要这两个库,因为它们都做不同的事情。Thanksher介绍了我是如何使用jquery transit、vector math和livescript实现的,这些工具非常有效,但对我来说非常先进。如果我不理解它,我就不能真正使用它,如果可能的话,我更愿意找到一个解决方案,让上面的内容一起工作。无论如何,谢谢。如果我没有使用Dragable插件,我会用它,如果我没有使用Dragable插件,thanksI会用它,如果我没有使用Dragable插件,thanksI会用它,如果我没有使用Dragable插件,thanksI会用它,谢谢
$(function() {

    var angle = 0;
    var int;
    rotateCircle();

    function rotateCircle() {
        int = setInterval(function() {
            angle += 3;
            $("#circle").rotate(angle);
        }, 100);
    }           

    $("#circle").mouseover(function() {
        clearInterval(int);
        Draggable.create("#circle", {type:"rotation",throwProps:true});
    }).mouseout(function() {
       rotateCircle();
    });



});


</script>