您好,登錄后才能下訂單哦!
這篇文章主要介紹了怎么用marquee元素實(shí)現(xiàn)滾動(dòng)字體與圖片的效果,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
marquee元素可以實(shí)現(xiàn)簡(jiǎn)單的字體(圖片等)的滑動(dòng)等效果:
<styletype="text/css">
#div01{
width:500px;
}
</style>
<scripttype="text/javascript">
</script>
<marqueebehavior="alertnate"><fontsize=30color='red'>www.baidu.com111</font></marquee>
<marqueedirection=rightbgcolor='#ff2233'behavior="alertnate"><fontsize=30color='blue'>www.baidu.com222</font></marquee>
<marqueeid="m3"direction=downbgcolor='#dbdbdb'height=50pxhspace=20pxvspace=20pxbehavior="alertnate"scrollLeft=leftonmouseover="this.stop()"onmouseout="this.start()"><fontsize=30color='blue'>www.baidu333.com</font></marquee>
<marqueeid="m4"direction=upbgcolor='#00dbdb'behavior="alertnate"><fontsize=30color='blue'>www.baidu444.com</font></marquee>
<divid="div01"><marqueedirection=rightbgcolor='#ff2233'behavior="alertnate"scrolldelay=100><fontsize=30color='blue'>www.baidu.com555</font></marquee></div>
<inputtype="button"onclick="m3.stop();"value="m3.stop"></input>
<inputtype="button"onclick="m3.start();"value="m3.start"></input>
<buttononclick="m4.stop();">m4.stop</button>
<buttononclick="m4.start();">m4.start</button>
direction表示滾動(dòng)的方向,值可以是left,right,up,down,默認(rèn)為left
behavior表示滾動(dòng)的方式,值可以是scroll(連續(xù)滾動(dòng))slide(滑動(dòng)一次)alternate(來回滾動(dòng))
loop表示循環(huán)的次數(shù),值是正整數(shù),默認(rèn)為無限循環(huán)
scrollamount表示運(yùn)動(dòng)速度,值是正整數(shù),默認(rèn)為6
scrolldelay表示停頓時(shí)間,值是正整數(shù),默認(rèn)為0,單位似乎是毫秒
align表示元素的垂直對(duì)齊方式,值可以是top,middle,bottom,默認(rèn)為middle
bgcolor表示運(yùn)動(dòng)區(qū)域的背景色,值是16進(jìn)制的RGB顏色,默認(rèn)為白色
height、width表示運(yùn)動(dòng)區(qū)域的高度和寬度,值是正整數(shù)(單位是像素)或百分?jǐn)?shù),默認(rèn)width=100%height為標(biāo)簽內(nèi)元素的高度
hspace、vspace表示元素到區(qū)域邊界的水平距離和垂直距離,值是正整數(shù),單位是像素。
onmouseover=this.stop()onmouseout=this.start()表示當(dāng)鼠標(biāo)以上區(qū)域的時(shí)候滾動(dòng)停止,當(dāng)鼠標(biāo)移開的時(shí)候又繼續(xù)滾動(dòng)。
以下是設(shè)置點(diǎn)擊按鈕時(shí)m3、m4的滾動(dòng)或停止:
<inputtype="button"onclick="m3.stop();"value="m3.stop"></input>
<inputtype="button"onclick="m3.start();"value="m3.start"></input>
<buttononclick="m4.stop();">m4.stop</button>
<buttononclick="m4.start();">m4.start</button>
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“怎么用marquee元素實(shí)現(xiàn)滾動(dòng)字體與圖片的效果”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。