0

让这个导航概念在 Chrome 和 Firefox 中运行良好,但在 Safari 中却非常不稳定。它似乎先在 Safari 中进行一半动画,然后才能正常运行。有任何想法吗?

<ul id="navigation">
    <a href="#"><li id="first"><span id="logo"></span><span class="navigation-text">Home</span></li></a>
    <a href="#"><li class="standard"><span class="gallery_icon"></span><span class="navigation-text">Gallery</span></li></a>
    <a href="#"><li class="standard"><span></span><span class="navigation-text">Gallery</span></li></a>
    <a href="#"><li class="standard"><span></span><span class="navigation-text">GalleryGallery123</span></li></a>
    <li id="last" class="standard"></li>
</ul>

<script type="text/javascript">
$(document).ready(function() {

    // On hover:
    $('#navigation li').hoverIntent(function () {
        width = $(this).children('span:nth-child(2)').width();
        text = $(this).children('span:nth-child(2)');          

        var newwidth = (width + 15) // Original width + 15px padding        
        text.filter(':not(:animated)').animate({"width":"0px"}, 0).show(); // Make the width 0px and make the element visible
        text.animate({"width":+newwidth+"px"}, 300); // Animate the width to the new size

    },
    function () {
        text.filter(':not(:animated)').animate({"width":"0px"}, 150); // Animate the width to 0px and hide the element
        text.animate({"width":+width+"px","float":"left"}, 0);
        setTimeout(function() {
            text.hide();
        },100);
    });

});

</script>

JSF中:

http://jsfiddle.net/7HWax/

4

1 回答 1

2

事实证明 Safari 不喜欢将动画设置为 0px。将 0px 更改为 1px 排序动画闪烁 :)

于 2013-03-05T22:48:16.583 回答