MonsterStars.

鼠标点击特效♡
点击特效♡<script type = "text/javascript" >/ 鼠标特效 /func...
扫描右侧二维码阅读全文
11
2018/06

鼠标点击特效♡


点击特效♡


<script type = "text/javascript" >
/ 鼠标特效 /
function getColorRandom() {

<span class="hljs-keyword">var</span> c = <span class="hljs-string">"#"</span>;
<span class="hljs-keyword">var</span> cArray = [<span class="hljs-string">"0"</span>, <span class="hljs-string">"1"</span>, <span class="hljs-string">"2"</span>, <span class="hljs-string">"3"</span>, <span class="hljs-string">"4"</span>, <span class="hljs-string">"5"</span>, <span class="hljs-string">"6"</span>, <span class="hljs-string">"7"</span>, <span class="hljs-string">"8"</span>, <span class="hljs-string">"9"</span>, <span class="hljs-string">"A"</span>, <span class="hljs-string">"B"</span>, <span class="hljs-string">"C"</span>, <span class="hljs-string">"D"</span>, <span class="hljs-string">"E"</span>, <span class="hljs-string">"F"</span>];
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i < <span class="hljs-number">6</span>; i++) {
    <span class="hljs-keyword">var</span> cIndex = <span class="hljs-built_in">Math</span>.round(<span class="hljs-built_in">Math</span>.random() * <span class="hljs-number">15</span>);
    c += cArray[cIndex];
}
<span class="hljs-keyword">return</span> c;

}
var a_idx = 0;
jQuery(document).ready(function($) {

$(<span class="hljs-string">"body"</span>).click(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">e</span>) </span>{
    <span class="hljs-keyword">var</span> a = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>(<span class="hljs-string">"富强"</span>, <span class="hljs-string">"民主"</span>, <span class="hljs-string">"文明"</span>, <span class="hljs-string">"和谐"</span>, <span class="hljs-string">"自由"</span>, <span class="hljs-string">"平等"</span>, <span class="hljs-string">"公正"</span>, <span class="hljs-string">"法治"</span>, <span class="hljs-string">"爱国"</span>, <span class="hljs-string">"敬业"</span>, <span class="hljs-string">"诚信"</span>, <span class="hljs-string">"友善"</span>);
    <span class="hljs-keyword">var</span> $i = $(<span class="hljs-string">"<span/>"</span>).text(a[a_idx]);
    a_idx = (a_idx + <span class="hljs-number">1</span>) % a.length;
    <span class="hljs-keyword">var</span> x = e.pageX,
    y = e.pageY;
    $i.css({
        <span class="hljs-string">"z-index"</span>: <span class="hljs-number">999999999999999999999999999999999999999999999999999999999999999999999</span>,
        <span class="hljs-string">"top"</span>: y - <span class="hljs-number">20</span>,
        <span class="hljs-string">"left"</span>: x,
        <span class="hljs-string">"position"</span>: <span class="hljs-string">"absolute"</span>,
        <span class="hljs-string">"font-weight"</span>: <span class="hljs-string">"bold"</span>,
        <span class="hljs-string">"color"</span>: getColorRandom()
    });
    $(<span class="hljs-string">"body"</span>).append($i);
    $i.animate({
        <span class="hljs-string">"top"</span>: y - <span class="hljs-number">180</span>,
        <span class="hljs-string">"opacity"</span>: <span class="hljs-number">0</span>
    },
    <span class="hljs-number">1500</span>,
    <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
        $i.remove();
    });
});

});

Last modification:June 16th, 2018 at 07:42 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment