Javascript mouse click Bubble Effect __java

Source: Internet
Author: User
a mouse-left-click Effect written in JS

Click the left mouse button will appear Hearts "❤" or character expression "(๑ ́₃ ̀๑)" ... Common emoji

Can be replaced, if you want to copy, please move from the bottom link to GitHub

Code

onload = function () {var click_cnt = 0;
    var $html = document.getelementsbytagname ("html") [0];
    var $body = document.getElementsByTagName ("body") [0];
        $html. onclick = function (e) {var $elem = document.createelement ("B");
        $elem. Style.color = "#E94F06";
        $elem. Style.zindex = 9999;
        $elem. style.position = "absolute";
        $elem. Style.select = "None";
        var x = E.pagex;
        var y = e.pagey;
        $elem. Style.left = (x-10) + "px";
        $elem. Style.top = (y-20) + "px";
        Clearinterval (ANIM);
                Switch (++click_cnt) {case: $elem. innertext = "Oωo";
            Break
                Case: $elem. innertext = "(๑ ́∀ ̀๑)";
            Break
                Case: $elem. innertext = "(๑ ́₃ ̀๑)";
            Break
                Case: $elem. innertext = "(๑ ̀_ ́๑)";
            Break Case: $elem.innertext = "( ̄へ ̄)";
            Break
                Case: $elem. innertext = "(╯° °) ╯ (┴-┴);
            Break
                Case: $elem. innertext = "૮ (ᵒ̌ dish ᵒ̌) ა";
            Break Case: $elem. innertext = "。 > Mouth <。
                ) ╭ ";
            Break
                Case: $elem. innertext = "(งᵒ̌ dish ᵒ̌) ง⁼³₌₃";
            Break
                Case 100:case 101:case 102:case 103:case 104:case 105:
                $elem. innertext = "(ꐦ°᷄д°᷅)";
            Break
                Default: $elem. innertext = "❤";
        Break
        $elem. Style.fontsize = Math.random () + 8 + "px";
        var increase = 0;
        var Anim;
                    settimeout (function () {anim = SetInterval (function () {if (++increase = = 150) {
                  Clearinterval (ANIM);  $body. RemoveChild ($elem);
                $elem. style.top = y-20-increase + "px";
            $elem. style.opacity = (150-increase)/120;
        }, 8);
        }, 70);
    $body. appendchild ($elem);
};
 };
Preview

GitHub Address:

Https://github.com/djzhao627/JSClickBubble

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.