Discuz Announcement Effect (automatic line feed, non-gap scrolling) _ javascript skills

Source: Internet
Author: User
Discuz announcement effect code, which can automatically wrap and scroll without gap

<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN "" http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd "> <HTML xmlns =" http://www.w3.org/1999/xhtml "> <HEAD> <TITLE> </TITLE> <META http-equiv = Content-Type content =" text/html; charset = gbk "> <style type =" text/css "> ul {padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px} # announcement {width: 100%; background: url (img/menu_bg.gif) repeat; overflow: hidden ;}# announcement p {border: # e6e6e6 1px solid; padding: 0px 10px 0px 10px; overflow-y: hidden; line-height: 24px; height: 24px} # announcement li {font-size: 12px; float: left; list-style-type: none; margin-right: 20px; padding-left: 10px; background: url (img/arrow_right.gif) no-repeat 0px 50%; white-space: nowrap} # announcement a {text-decoration: none ;}# announcement: hover {text-decoration: underline ;}</style> </HEAD> <BODY> <UL> <LI> share a form verification function (P. M .) </LI> <LI> meaning of block-level elements and cascade elements (200 8-12-13 p.m.) </LI> <LI> How do I set the width attribute without line breaks ?? (P.m.) </LI> <LI> after javascript is executed, the GIF animation remains static ?? (P. M .) </LI> <LI> raster map-based Query System (slice Cache Technology) (P. M .) </LI> <LI> [Switch] communication between flash and javascript (javascript calls functions in flash) (P. M .) </LI> <LI> do not use loops or callback functions to output 1 ~ 100 (P. M .) </LI> <LI> simple js image proportional Scaling (P. M .) </LI> <LI> beibei.com music address reader (P. M .) </LI> </UL> <script type = "text/javascript"> function $ (id) {return document. getElementById (id);} var anndelay = 3000; var anncount = 0; var annheight = 24; var annst = 0; function announcementScroll () {if (! Annst) {$ ('announcementbody '). innerHTML + = '<br style = "clear: both"/>' + $ ('announcementbody '). innerHTML; $ ('announcementbody '). scrollTop = 0; if ($ ('announcementbody '). scrollHeight> annheight * 3) {annst = setTimeout ('announcementscroll () ', anndelay);} else {$ ('announcement '). onmouseover = $ ('announcement '). onmouseout = null;} return;} if (anncount = annheight) {if ($ ('announcementbody '). scrollHeight-annheight <= $ ('announcementbody '). scrollTop) {$ ('announcementbody '). scrollTop = $ ('announcementbody '). scrollHeight/2-annheight;} anncount = 0; annst = setTimeout ('announcementscroll () ', anndelay);} else {$ ('announcementbody '). scrollTop ++; anncount ++; annst = setTimeout ('announcementscroll () ', 10) ;}} announcementScroll (); script </BODY> </HTML>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.