Discuz announcement effect (automatic line wrapping, no gap scrolling) _javascript tips

Source: Internet
Author: User
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "http://www.w3c.org/TR/1999/REC-html401-19991224/ Loose.dtd "> <ptml 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 Div {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 a:hover {text-decoration:underline; } </style> </HEAD> <BODY> <div id=announcement onmouseover= "if (!anncount) {cleartimeout (annst); a Nnst = 0} "onmouseout=" if (!annst) Annst = settimeout (' Announcementscroll () ', anndelay); " > <div id=announcementbody> <UL> <LI> Share form validation functions (2008-12-16 05:30 p.m.) </LI> <LI> block-level elements and Meaning of cascading elements (2008-12-13 03:39 p.m.) </LI> <LI> How do I set <span> width property without wrapping?? (2008-12-13 03:23 p.m.) </LI> <LI> performing JavaScript, the GIF animation is still?? (2008-12-13 03:12 p.m.) </LI> <LI> query system based on raster map (slice caching technology) (2008-11-29 07:38 p.m.) </LI> <LI> "Turn" Communication between Flash and JavaScript (JavaScript calls functions in Flash) (2008-11-27 07:45 p.m.) </LI> <LI> do not use loops and callback functions to output characters 1~ (2008-11-23 03:00 p.m.) </LI> <LI> Compact JS image scaling (2008-11-22 04:54 p.m.) </LI> <LI> Decibel Network Music Address acquisition (2008-11-20 05:19 p.m.) </LI> </UL> </DIV> </DIV> <script type= "Text/javascript" & Gt 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/> ' + $ (' Announcementbod Y '). 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 All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.