swing div的动画正受到其他div的影响

时间:2014-10-09 15:25:07

标签: javascript html css css-animations

我正在尝试在悬停上实现摆动效果并且它完美地工作但是当我向其他元素添加不同的效果时,它的效果会受到影响!

<!-- THIS CODE BRAKES SWING-->
<div id="abc"> <a href="#" title="Social Cause" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Litter','','Images/abc2.png',1)"><img src="Images/abc1.jpg" width="203" height="311" id="Litter"></a>
</div>

的CSS:

  #litter {
    position: absolute;
    left: 483px;
top: 0px;
    width: 203px;
    height: 380px;
    z-index: 1;
}

JS

function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr;
    for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_swapImage() { //v3.0
    var i, j = 0,
        x, a = MM_swapImage.arguments;
    document.MM_sr = new Array;
    for (i = 0; i < (a.length - 2); i += 3)
    if ((x = MM_findObj(a[i])) != null) {
        document.MM_sr[j++] = x;
        if (!x.oSrc) x.oSrc = x.src;
        x.src = a[i + 2];
    }
}

这是一个摆动得恰到好处的小提琴! http://jsfiddle.net/9eceztyk/

0 个答案:

没有答案