谁能给点HTML跑马灯效果的代码?

html-css013

谁能给点HTML跑马灯效果的代码?,第1张

<marquee>...</marquee>普通卷动

<marquee behavior=slide>...</marquee>滑动

<marquee behavior=scroll>...</marquee>预设卷动

<marquee behavior=alternate>...</marquee>来回卷动

<marquee direction=down>...</marquee>向下卷动

<marquee direction=up>...</marquee>向上卷动

<marquee direction=right></marquee>向右卷动

<marquee direction=’left’></marquee>向左卷动

<marquee loop=2>...</marquee>卷动次数

<marquee width=180>...</marquee>设定宽度

<marquee height=30>...</marquee>设定高度

<marquee bgcolor=FF0000>...</marquee>设定背景颜色

<marquee scrollamount=30>...</marquee>设定滚动速度

<marquee scrolldelay=300>...</marquee>设定卷动时间

<marquee onmouseover="this.stop()">...</marquee>鼠标经过上面时停止滚动

<marquee onmouseover="this.start()">...</marquee>鼠标离开时开始滚动

要实现简单的跑马灯效果其实运用html中<marquee></marquee>标签就可以达到了基本属性如下: 1.滚动方向direction(包括4个值:up、 down、 left和 right) 2.滚动方式behavior(scroll:循环滚动,默认效果; slide:只滚动一次就停止; alternate:来回交替进行滚动) 3.滚动速度scrollamount(滚动速度是设置每次滚动时移动的长度,以像素为单位) 4.滚动延迟scrolldelay(设置滚动的时间间隔,单位是毫秒) 5.滚动循环loop(默认值是-1,滚动会不断的循环下去) 6.滚动范围width、height 7.滚动背景颜色bgcolor 8.空白空间hspace、vspace如果想要更多的动画效果,更多选择jquery.marquee.js这款插件——ul里的啥都能滚并自带悬停效果1.html 中写入<ul id="marquee"><li></li></ul> 2.js中调入$("#marquee").marquee()即可 3.css比较简单,一般自己写,大致如下: ul.marquee{display:blockline-height:1position:relativeoverflow:hiddenwidth:400pxheight:22px}ul.marquee li{ position:absolutetop:-999emleft:0display:blockwhite-space:nowrap padding:3px5pxtext-indent:0.8em} 4.相关参数如下: {yScroll:"top" // 初始滚动方向 (还可以是"top" 或 "bottom") showSpeed:850 // 初始下拉速度 scrollSpeed:12 // 滚动速度 pauseSpeed:5000 // 滚动完到下一条的间隔时间 pauseOnHover:true // 鼠标滑向文字时是否停止滚动 loop:-1 // 设置循环滚动次数 (-1为无限循环) fxEasingShow:"swing" // 缓冲效果 fxEasingScroll:"linear" // 缓冲效果 cssShowing:"marquee-showing" //定义class event handlers init:null // 初始调用函数 beforeshow:null // 滚动前回调函数 show:null // 当新的滚动内容显示时回调函数 aftershow:null // 滚动完了回调函数 }