Karaoke subtitle Effect _javascript Skills

Source: Internet
Author: User
The subtitles in the karaoke will gradually light up as the song progresses, because the subtitles is not a place to light but gradually transition, so we implement the effect in the Web page, through two layers to achieve, two layers of the same text, different colors, the bottom is unchanged, the upper layer gradually Lacoine to cover the lower level, the realization of the effect, in This principle is also true when implementing this effect in Flash. This article gives the basic example to give a try.
The point is that the text size and row height of the two layers are the same, setting the reasonable position, top, overflow, width style properties, and nowrap HTML attributes for the second layer.
Note that different browsers may not be able to achieve this effect because of different interpretations of CSS and lack of some attribute support, please see the example in IE.
<textarea id="runcode98362"><ptml> <pead> <meta http-equiv= "Content-type" content= "text/html charset=gb2312" > <title& GT, Karaoke effect </title> </pead> <body> <table cellpadding= "0" cellspacing= "0" bordercolor= "#111111 "Width=" 100% "> <tr> <td width=" 100% "> <div > Who cares how bitter my heart is. </div> <div id=" AV " Nowrap> who cares how bitter my heart </div></td> </tr> </table> <script type= "Text/javascript" language= "JavaScript" > <!--var av = document.getElementById ("av"); function Musicgo () {var width = parseint (av.style.width); 140 of the reason is the font size by word if (width < 140) {Av.style.width = (width + 1) + "px"; else {av.style.width = "0px"; } av.style.width = "0px";//because it is not specified in the previous style sheet, you must specify SetInterval ("Musicgo ();", 10) in JavaScript; --> </script> </body> </ptml></textarea>
[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.