自动垂直滚动div内容循环 [英] Automatically vertically scroll div contents looping

查看:723
本文介绍了自动垂直滚动div内容循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一个简单的方法来创建一个只有文本的div,并自动垂直滚动文本。我不想使用框架(尽管我使用Prototype,所以如果使用Prototype更容易,那很好,但不是Scriptalicious)。



我假设必须有几行代码才能做到这一点,但我对JavaScript不熟悉,不知道如何最有效地做到这一点。

解决方案

这可能不是常规的,但您可以尝试< marquee> 标记

<

 < marquee behavior =在IE和FF中都能正常工作,而且上次我也检查了safari。滚动direction =upheight =250
scrollamount =2scrolldelay =10>
您的内容放在这里
< / marquee>

应该给你想要的东西,

,你可以像任何< div> ...

,然后还有没有javascript的额外优势...



针对您的评论进行修改



它会变得更好,在任何浏览器中都可以试用这个功能
$ b $ pre $ onmouseover = this.stop()onmouseout =this.start()

p>

  style =filter:progid:DXImageTransform.Microsoft.Alpha(Opacity = 0,
FinishOpacity = 100,
样式= 1,StartX = 0,FinishX = 0,StartY = 0,FinishY = 10)
progid:DXImageTransform.Microsoft.Alpha(Opacity = 100,FinishOpacity = 0,
Style = 1,StartX = 0,FinishX = 0,StartY = 90,FinishY = 100)

标签......


I am trying to find a simple way to have a div with just text in it automatically scroll the text vertically. I don't want to use a framework (though I do use Prototype, so if it is easier using Prototype then that is fine, but no Scriptalicious).

I assume there has got to be a way to do this with a few lines of code, but I am not familiar enough with Javascript to know how to most effectively do that.

解决方案

This might not be conventional but you can try the <marquee> tag

it works both in IE and FF, and the last time I checked, safari too.

<marquee behavior="scroll" direction="up" height="250" 
   scrollamount="2" scrolldelay="10"">
  Your content goes here
</marquee>

should give you what you want,
and you can style them like any <div>...
and then there is the added advantage of having no javascript...

Edit in response to your comment

It gets better, try this in any browser

onmouseover="this.stop()" onmouseout="this.start()"

And this in IE

style="filter:progid:DXImageTransform.Microsoft.Alpha( Opacity=0,
FinishOpacity=100, 
Style=1, StartX=0,  FinishX=0, StartY=0, FinishY=10) 
progid:DXImageTransform.Microsoft.Alpha( Opacity=100, FinishOpacity=0, 
Style=1, StartX=0, FinishX=0, StartY=90, FinishY=100)" 

As attributes of the marquee tag...

这篇关于自动垂直滚动div内容循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆