尝试找出文本滚动效果

发布于 2024-12-01 06:20:17 字数 422 浏览 1 评论 0原文

我喜欢在网站上看到的一种效果,并且我一直在仔细地筛选他们的 javascript 和 CSS,看看它是如何完成的。然而,该网站是韩国的,这让它变得更加困难,因为我一开始就不太精通 javascript。

该网站是: http://search.naver.com/search.naver?where=nexearch&query=idolfix&sm=top_hty&fbm=1&ie=utf8

有没有人见过这个效果页面的右上角,页面每隔几秒更新 10 个链接 - 特别是文本滚动到位的方式?

I like an effect that I have seen on a web site and I have been paintstakingly sifting through their javascript and CSS to see how its done. However, the site is Korean and to make it more difficult, I am not too well versed in javascript to begin with.

The site is:
http://search.naver.com/search.naver?where=nexearch&query=idolfix&sm=top_hty&fbm=1&ie=utf8

Has anyone ever seen the effect on the top right of the page where the page is updating the 10 links every few seconds - specifically the way the text scrolls in place?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妄断弥空 2024-12-08 06:20:17

他们有一个带有 overflow:hidden 的包装 div。

然后在该 div 内有 2 个 div,分别包含当前值和下一个值。

<div class="wrap">
    <div class="current">
        foo
    </div>
    <div class="next">
        bar
    </div>
</div>

效果完成后,您只需将 .next 设为 .current ,然后使用 AJAX 添加一个新的 .next 值。

首先,.next div 位于 .wrapper 的外部(实际上在下面),然后他们将其向上移动。

使用 jQuery 同时移动两个 div 可以轻松实现此效果。

$('.current').animate({
    'top': '-1em'
});
$('.next').animate({
    'top': 0
});

这是一个实例: http://jsfiddle.net/tusbar/GFZTE/

They have a wrapper div that has overflow: hidden.

Then inside that div they have 2 divs with the current and the next value.

<div class="wrap">
    <div class="current">
        foo
    </div>
    <div class="next">
        bar
    </div>
</div>

After the effect you just have to make the .next the .current one, and add a new .next value with AJAX.

At first, the .next div is outside the .wrapper (underneath actually), then they move it up.

The effect could easily be done with jQuery moving the two divs at the same time.

$('.current').animate({
    'top': '-1em'
});
$('.next').animate({
    'top': 0
});

Here's a live example: http://jsfiddle.net/tusbar/GFZTE/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文