How to Use jQuery to simulate the matrix effect of the matrix _ jquery-js tutorial

Source: Internet
Author: User
This article mainly introduces jQuery's method of simulating the matrix effect of the matrix. The example shows how to use jQuery to operate the page elements to achieve the animation effect, for more information about how jQuery simulates the matrix effect of the matrix, see the following example. Share it with you for your reference. The specific implementation method is as follows:

The html section is as follows:

10001001110010010010000

the answer is in your mind

The css section is as follows:

#container p{padding:10px;position:absolute;border:0px dotted brown;width:0px;color:green;text-shadow: 1px 1px 3px #cccccc;}.text{padding:10px;color:#ccc;}#panel{width:400px;margin:0 auto;color:white;margin-top:20%;font-size:15px;font-weight:bold;z-index:99999;background:black;}

The js section is as follows:

$ (Function () {for (var I = 0; I <3; I ++) $ ('P', '# iner '). clone (). prependTo ('# iner'); // Add the data range (); setInterval (drop, 150); // The speed is 150 milliseconds }); // arrange function range () {var num = 1; $ ('P', '# iner '). each (function (I) {var ww = $ (window ). width (); // window width var wh = $ (window ). height (); var ol = $ (this ). offset (). left; // left pixel var ot =-20; // $ (this ). offset (). top; // starting from above the header I ++; if (I % 22 = 0) Num = 1; // 22 rows (this).css ({"left": (ol + num * 60) + "px", "top": (ot + Math. ceil (I/2) * 30) + "px"}); // keep the left distance, and change the num ++ from the top ;});} // function drop () {$ ('P', '# iner '). each (function (I) {var wh = $ (window ). height (); var ol = $ (this ). offset (). left; var ot = $ (this ). offset (). top; var rnd = Math. round (Math. random () * 100); var rnd2 = Math. round (Math. random () * 50); // I = 0? 0.5: I; ((this).css ({"top": (ot + rnd + rnd2) + "px"}); // The landing speed if (ot> = wh) // if it falls below the window {// ((this).css ({"top": wh-20 + "px "}); // stop at the current position and do not continue to drop the cursor (this).css ({"top":-5 * rnd + "px"}); // start from the top }});}

I hope this article will help you with jQuery programming.

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.