0

我正在寻找一个好的垂直气泡框插件。

不是简单的垂直选框,我正在寻找一个好的“类似闪光”的效果插件,从 div 内容的底部到顶部的元素选框平滑。

可能真的很好,但我认为这个插件只是在我的梦想中

4

2 回答 2

1

好吧,它的效率不是很高,但我认为这是一个好的开始:

jQuery.fn.verticalMarquee = function(vertSpeed, horiSpeed) {
    this.css('float', 'left');

    vertSpeed = vertSpeed || 1;
    horiSpeed = 1/horiSpeed || 1;

    var windowH = this.parent().height(),
        thisH = this.height(),
        parentW = (this.parent().width() - this.width()) / 2,
        rand = Math.random() * 1000,
        current = this;

    this.css('margin-top', windowH + thisH);
    this.parent().css('overflow', 'hidden');

    setInterval(function() {
        current.css({
            marginTop: function(n, v) {
                return parseFloat(v) - vertSpeed;
            },
            marginLeft: function(n, v) {
                return (Math.sin(new Date().getTime() / (horiSpeed * 1000) + rand) + 1) * parentW;
            }
        });
    }, 15);

    setInterval(function() {
        if (parseFloat(current.css('margin-top')) < -thisH) {
            current.css('margin-top', windowH + thisH);
        }
    }, 250);
};

$('.message').verticalMarquee(0.5, 1);

它用于Math.sin水平移动元素。该函数verticalMarquee接受两个参数,一个用于垂直速度,另一个用于水平速度。该函数只能在只包含一个元素的 jQuery 对象上调用 - 在测试期间,一次动画超过一个元素会导致可怕的滞后量。

在这里查看一个简单的演示:http: //jsfiddle.net/CcccQ/2/

于 2010-11-14T13:30:15.657 回答
0

你的意思是像The Silky Smooth Marquee插件这样的东西吗?

于 2010-11-13T16:18:43.673 回答