Javascript jQueryRollowlever-闪烁问题

Javascript jQueryRollowlever-闪烁问题,javascript,jquery,html,css,Javascript,Jquery,Html,Css,因此,我正在处理一些代码,这些代码将有一个高亮显示的状态,而其他元素将淡出。我在这个构建中遇到的问题是,当你在元素间快速移动时,效果往往会闪烁。有什么东西我丢了或者需要拿出来吗?这是代码,然后在fiddle链接之后 <script type='text/javascript'> $(document).ready(function(){ $.fn.wait = function(time, type) { time = time || 300; ty

因此,我正在处理一些代码,这些代码将有一个高亮显示的状态,而其他元素将淡出。我在这个构建中遇到的问题是,当你在元素间快速移动时,效果往往会闪烁。有什么东西我丢了或者需要拿出来吗?这是代码,然后在fiddle链接之后

<script type='text/javascript'>
$(document).ready(function(){
 $.fn.wait = function(time, type) {
        time = time || 300;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };
    $("#sites li:not(#sites li li)").hover(function(){
        $(this).attr('class', 'current'); // Add class .current
        $("#sites li:not(#sites li.current,#sites li li)").fadeTo("slow", 0.3); // Fade other items to 30%
        },function(){
        $("#sites li:not(#sites li.current,#sites li li)").wait().fadeTo(600, 1.0); // This should set the other's opacity back to 100% on mouseout
        $(this).removeClass("current"); // Remove class .current
    });
});
</script>
使用。停止以停止flickr

如何使用:

$element.stop.fadeTo


您是否添加了$.fn.wait以解决闪烁问题?如果删除该选项,然后在fadeTo之前调用.stop,这将解决闪烁问题。