marquee元素實現滾動字體圖片滑動等效果
來源:易賢網 閱讀:748 次 日期:2016-06-16 13:51:44
溫馨提示:易賢網小編為您整理了“marquee元素實現滾動字體圖片滑動等效果”,方便廣大網友查閱!

marquee元素可以實現簡單的字體(圖片等)的滑動等效果: 

代碼如下:

<style type="text/css"> 

#div01{ 

width: 500px; 

</style> 

<script type="text/javascript"> 

</script> 

<marquee behavior="alertnate"><font size=30 color='red'>www.baidu.com111</font></marquee> 

<marquee direction=right bgcolor='#ff2233' behavior="alertnate"><font size=30 color='blue'>www.baidu.com222</font></marquee> 

<marquee id="m3" direction=down bgcolor='#dbdbdb' height=50px hspace=20px vspace=20px behavior="alertnate" scrollLeft=left onmouseover="this.stop()" onmouseout="this.start()"><font size=30 color='blue'>www.baidu333.com</font></marquee> 

<marquee id="m4" direction=up bgcolor='#00dbdb' behavior="alertnate"><font size=30 color='blue'>www.baidu444.com</font></marquee> 

<div id="div01"><marquee direction=right bgcolor='#ff2233' behavior="alertnate" scrolldelay=100><font size=30 color='blue'>www.baidu.com555</font></marquee></div> 

<input type="button" onclick="m3.stop();" value="m3.stop"></input> 

<input type="button" onclick="m3.start();" value="m3.start"></input> 

<button onclick="m4.stop();">m4.stop</button> 

<button onclick="m4.start();">m4.start</button> 

direction 表示滾動的方向,值可以是left,right,up,down,默認為left 

behavior 表示滾動的方式,值可以是scroll(連續(xù)滾動)slide(滑動一次)alternate(來回滾動) 

loop 表示循環(huán)的次數,值是正整數,默認為無限循環(huán) 

scrollamount 表示運動速度,值是正整數,默認為6 

scrolldelay 表示停頓時間,值是正整數,默認為0,單位似乎是毫秒 

align 表示元素的垂直對齊方式,值可以是top,middle,bottom,默認為middle 

bgcolor 表示運動區(qū)域的背景色,值是16進制的RGB顏色,默認為白色 

height、width 表示運動區(qū)域的高度和寬度,值是正整數(單位是像素)或百分數,默認width=100% height為標簽內元素的高度 

hspace、vspace 表示元素到區(qū)域邊界的水平距離和垂直距離,值是正整數,單位是像素。 

onmouseover=this.stop() onmouseout=this.start() 表示當鼠標以上區(qū)域的時候滾動停止,當鼠標移開的時候又繼續(xù)滾動。 

以下是設置點擊按鈕時m3、m4的滾動或停止: 

代碼如下:

<input type="button" onclick="m3.stop();" value="m3.stop"></input> 

<input type="button" onclick="m3.start();" value="m3.start"></input> 

<button onclick="m4.stop();">m4.stop</button> 

<button onclick="m4.start();">m4.start</button>

更多信息請查看網頁制作

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網