循环Jquery + mouseover/mouseout事件

circulate Jquery + mouseover/mouseout event

本文关键字:mouseout 事件 mouseover Jquery 循环      更新时间:2023-09-26

我试图使用。circulation
我想让动画在onmouseover/onmouseout

时停止(暂停)/继续

下面是来自https://css-tricks.com/examples/Circulate/

的代码
html:
<div id="sphere-area" >
<img src="a.png" alt="ball" id="orange-ball" />
alt="" />
</div>

Js:
function startBallOne() {
$("#orange-ball").circulate({
    speed: 4000,
    height: 100,
    width: -880,
    sizeAdjustment: 40,
    loop: true,
    zIndexValues: [1, 1, 3, 3]
});
}

i tried

$("#orange-ball").mouseout(circulate(...

$("#orange-ball").mouseover(function(){
$(this).circulate

但没有工作…

有什么想法吗?

TIA

试着把你的JS代码放在$(doument).ready()函数里面。

$(document).ready(function(){
    function startBallOne() {
        $("#orange-ball").circulate({
            speed: 4000,
            height: 100,
            width: -880,
            sizeAdjustment: 40,
            loop: true,
            zIndexValues: [1, 1, 3, 3]
        });
    }
});