4 HTML5煙火燃放特效程式碼</ title> 5 6 <"/><meta property="og:local" content="zh-tw"> <meta property="og:title" content="JQuery和html+css實作滑鼠點擊放煙火-js教程-PHP中文網"> <meta property="og:description" content="1 <!DOCTYPE html> 2 <html> 3 <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4 <title>HTML5煙火燃放特效程式碼</ title> 5 6 <"> <meta property="og:url" content="https://m.php.cn/zh-tw/faq/369620.html"> <meta property="og:image" content="https://m.php.cn/static/images/logo.png"> <meta property="og:site_name" content="php.cn"> <meta property="og:type" content="website"> <link rel="canonical" href="https://www.php.cn/zh-tw/faq/369620.html"/> <link rel="alternate" hrefLang="zh-cn" href="https://m.php.cn/zh/faq/369620.html" /> <link rel="alternate" hrefLang="en" href="https://m.php.cn/faq/369620.html" /> <link rel="alternate" hrefLang="zh-tw" href="https://m.php.cn/zh-tw/faq/369620.html" /> <link rel="alternate" hrefLang="ja" href="https://m.php.cn/ja/faq/369620.html" /> <link rel="alternate" hrefLang="ko" href="https://m.php.cn/ko/faq/369620.html" /> <link rel="alternate" hrefLang="ms" href="https://m.php.cn/ms/faq/369620.html" /> <link rel="alternate" hrefLang="fr" href="https://m.php.cn/fr/faq/369620.html" /> <link rel="alternate" hrefLang="de" href="https://m.php.cn/de/faq/369620.html" /> <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, user-scalable=1" /><meta name="applicable-device" content="mobile" /><link rel="stylesheet" href="/static/css/style.css?4.5.31"><link href="/static/front/mobcss/newphpcommon.css?1.1" type="text/css" rel="stylesheet"/><link href="/static/front/mobcss/swiper.min.css" type="text/css" rel="stylesheet"/><link href="/static/front/mobcss/newphp.css?1.2" type="text/css" rel="stylesheet"/><link href="/static/css/global.css" type="text/css" rel="stylesheet"/><link href="/static/layui/css/layui.css" type="text/css" rel="stylesheet"/><link href="/static/mobcss/mobindex3.css" type="text/css" rel="stylesheet"/><script src="/static/front/mobjs/jquery-1.6.1.min.js"></script><script src="/static/front/mobjs/swiper.min.js"></script><script src="/static/front/mobjs/newphpcommon.js"></script><link rel="canonical" href="https://www.php.cn/zh-tw/faq/369620.html"/> <link rel="alternate" hrefLang="zh-cn" href="https://m.php.cn/zh/faq/369620.html" /> <link rel="alternate" hrefLang="en" href="https://m.php.cn/faq/369620.html" /> <link rel="alternate" hrefLang="zh-tw" href="https://m.php.cn/zh-tw/faq/369620.html" /> <link rel="alternate" hrefLang="ja" href="https://m.php.cn/ja/faq/369620.html" /> <link rel="alternate" hrefLang="ko" href="https://m.php.cn/ko/faq/369620.html" /> <link rel="alternate" hrefLang="ms" href="https://m.php.cn/ms/faq/369620.html" /> <link rel="alternate" hrefLang="fr" href="https://m.php.cn/fr/faq/369620.html" /> <link rel="alternate" hrefLang="de" href="https://m.php.cn/de/faq/369620.html" /> <script> var canshu = { SeeMore:'看更多', FoldUp:'折起來', Choice:'語言', wait:'正在加載,請稍候~', LoginFirst:"請先登入", needKeyword:'輸入關鍵字搜尋', emailPhoneError:'請輸入正確的電話或電子郵件地址', missPwd:'請輸入密碼', emailError:'請輸入您正確的電子郵件地址', VerCode:"請輸入驗證碼", getCode:'傳送', pwdError:'密碼格式不正確', TwoPassNotMatch:'兩個密碼不匹配', Bindemail:'綁定信箱', resetpassword:'重新設密碼', ConfirmPass:'確認密碼', pwdCheck:'請輸入6-18個字母或數字', Editinfor: '編輯個人資訊', trimContent:'請輸入內容', titleCheck:'標題長度應至少為 5 個字', choiceLang:'請選擇語言分類', Secondreply:'回覆', NetWorkError:'網路錯誤,請稍後重試!', keywordSearch:'輸入關鍵字搜尋', all_lang_string:'zh|en|zh-tw|ja|ko|ms|fr|de', Next:'下一頁', Previous:'上一頁' }; </script><!-- Google Tag Manager --><script> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl; f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WWVXRJPW'); </script><!-- End Google Tag Manager --><!-- Google tag (gtag.js) --><script async src="https://www.googletagmanager.com/gtag/js?id=G-H42EVCYBJC"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-H42EVCYBJC'); </script><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5902227090019525" crossorigin="anonymous"></script><!--<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6267705206177514" crossorigin="anonymous"></script>--><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"WebSite","url":"https:\/\/m.php.cn\/zh-tw\/","potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/m.php.cn\/zh-tw\/search?word={search_term_string}"},"query-input":"required name=search_term_string"}}</script><meta property="article:author" content="PHP中文网" /><meta property="article:published_first" content=",https://www.php.cn/faq/369620.html" /><link rel="stylesheet" href="/static/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css?1"><link rel="stylesheet" href="/static/ueditor/third-party/SyntaxHighlighter/shCoreDefault1.css"><link href="/static/mobcss/newphp.css" type="text/css" rel="stylesheet"/><script src="/static/ueditor/third-party/SyntaxHighlighter/shCore.js"></script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script><script> var xnb_name = 'Virtual currency'; </script><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","headline":"JQuery和html+css實作滑鼠點擊放煙火","description":"1 <!DOCTYPE html> 2 <html> 3 <head><meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\"> 4 <title>HTML5煙火燃放特效程式碼<\/ title> 5 6 <","datePublished":"2017-06-20T09:36:00+8:00","author":{"url":"https:\/\/m.php.cn\/zh-tw\/member\/1.html","name":"PHP中文网"},"mainEntityOfPage":{"@type":"WebPage","@id":"https:\/\/m.php.cn\/zh-tw\/faq\/369620.html"},"url":"https:\/\/m.php.cn\/zh-tw\/faq\/369620.html","articleBody":"<div class=\"cnblogs_code\">\n<pre><span style=\"color: #008080\"> 1<\/span> \n<span style=\"color: #008080\"> 2<\/span> \n<span style=\"color: #008080\"> 3<\/span> <meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\">\n<span style=\"color: #008080\"> 4<\/span> <title>HTML5烟花燃放特效代码<\/title>\n<span style=\"color: #008080\"> 5<\/span> \n<span style=\"color: #008080\"> 6<\/span> <style>\n<span style=\"color: #008080\"> 7 html,body{height:100%;margin:0;padding:0<span style=\"color: #000000\">}\n<span style=\"color: #008080\"> 8 ul,li{text-indent:0;text-decoration:none;margin:0;padding:0<span style=\"color: #000000\">}\n<span style=\"color: #008080\"> 9 img{border:0<span style=\"color: #000000\">}\n<span style=\"color: #008080\"> 10 body{background-color:#000;color:#999;font:100%\/18px helvetica, arial, sans-serif}\n<span style=\"color: #008080\"> 11 canvas{cursor:crosshair;display:block;left:0;position:absolute;top:0;z-index:20<span style=\"color: #000000\">}\n<span style=\"color: #008080\"> 12 *<span style=\"color: #000000\">{\n<span style=\"color: #008080\"> 13 <span style=\"color: #000000\"> margin: 0px;\n<span style=\"color: #008080\"> 14 <span style=\"color: #000000\"> padding: 0px;\n<span style=\"color: #008080\"> 15 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 16 <span style=\"color: #000000\"> #bg_Img{\n<span style=\"color: #008080\"> 17 <span style=\"color: #000000\"> width: 1920px;\n<span style=\"color: #008080\"> 18 <span style=\"color: #000000\"> height: 1500px;\n<span style=\"color: #008080\"> 19 <span style=\"color: #000000\"> border: 1px solid transparent;\n<span style=\"color: #008080\"> 20 background: url(\"start.gif\"<span style=\"color: #000000\">) repeat;\n<span style=\"color: #008080\"> 21 text-<span style=\"color: #000000\">align: center;\n<span style=\"color: #008080\"> 22 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 23 <span style=\"color: #000000\"> ul{\n<span style=\"color: #008080\"> 24 <span style=\"color: #000000\"> width: 5555px;\n<span style=\"color: #008080\"> 25 <span style=\"color: #000000\"> height: 200px;\n<span style=\"color: #008080\"> 26 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 27 <span style=\"color: #000000\"> li{\n<span style=\"color: #008080\"> 28 font: 120px\/190px \"楷体\";\n<span style=\"color: #008080\"> 29 <span style=\"color: #000000\"> color: white;\n<span style=\"color: #008080\"> 30 text-<span style=\"color: #000000\">shadow: 5px 10px 10px 10px;\n<span style=\"color: #008080\"> 31 list-<span style=\"color: #000000\">style: none;\n<span style=\"color: #008080\"> 32 <span style=\"color: #0000ff\">float<span style=\"color: #000000\">: left;\n<span style=\"color: #008080\"> 33 <span style=\"color: #000000\"> display: none;\n<span style=\"color: #008080\"> 34 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 35 <span style=\"color: #000000\"> #text_bd{\n<span style=\"color: #008080\"> 36 <span style=\"color: #000000\"> width: 600px;\n<span style=\"color: #008080\"> 37 <span style=\"color: #000000\"> height: 200px;\n<span style=\"color: #008080\"> 38 <span style=\"color: #000000\"> border: 5px solid transparent;\n<span style=\"color: #008080\"> 39 margin-<span style=\"color: #000000\">left: 200px;\n<span style=\"color: #008080\"> 40 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 41 <span style=\"color: #000000\"> #mouse_click{\n<span style=\"color: #008080\"> 42 <span style=\"color: #000000\"> margin: 0px auto;\n<span style=\"color: #008080\"> 43 text-<span style=\"color: #000000\">align: center;\n<span style=\"color: #008080\"> 44 <span style=\"color: #000000\"> color: white;\n<span style=\"color: #008080\"> 45 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 46 <\/style>\n<span style=\"color: #008080\"> 47<\/span> \n<span style=\"color: #008080\"> 48<\/span> \n<span style=\"color: #008080\"> 49<\/span> \n<span style=\"color: #008080\"> 50<\/span> <div id=\"bg_Img\">\n<span style=\"color: #008080\"> 51<\/span> <div id=\"text_bd\">\n<span style=\"color: #008080\"> 52<\/span> <ul>\n<span style=\"color: #008080\"> 53<\/span> <li>O(∩_∩)O~~<\/li>\n<span style=\"color: #008080\"> 54<\/span> <li>同<\/li>\n<span style=\"color: #008080\"> 55<\/span> <li>学<\/li>\n<span style=\"color: #008080\"> 56<\/span> <li>们<\/li>\n<span style=\"color: #008080\"> 57<\/span> <li>节<\/li>\n<span style=\"color: #008080\"> 58<\/span> <li>日<\/li>\n<span style=\"color: #008080\"> 59<\/span> <li>快<\/li>\n<span style=\"color: #008080\"> 60<\/span> <li>乐<\/li>\n<span style=\"color: #008080\"> 61<\/span> <li>~~<\/li>\n<span style=\"color: #008080\"> 62<\/span> <\/ul>\n<span style=\"color: #008080\"> 63<\/span> <\/div>\n<span style=\"color: #008080\"> 64<\/span> <div id=\"mouse_click\">鼠标点击释放烟花效果<\/div>\n<span style=\"color: #008080\"> 65<\/span> <\/div>\n<span style=\"color: #008080\"> 66<\/span> <script type=\"text\/javascript\" src=\"jquery-3.1.1.js\"><\/script>\n<span style=\"color: #008080\"> 67<\/span> <script type=\"text\/javascript\">\n<span style=\"color: #008080\"> 68 <span style=\"color: #0000ff\">var aLi=document.querySelectorAll(\"li\"<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 69 setInterval(a,1000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 70 setInterval(b,2000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 71 setInterval(c,3000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 72 setInterval(d,4000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 73 setInterval(e,5000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 74 setInterval(f,6000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 75 setInterval(g,7000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 76 setInterval(h,8000<span style=\"color: #000000\">);\n<span style=\"color: #008080\"> 77 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> a() {\n<span style=\"color: #008080\"> 78 aLi[0].style.display = \"block\"\n<span style=\"color: #008080\"> 79 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 80 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> b() {\n<span style=\"color: #008080\"> 81 aLi[1].style.display = \"block\"\n<span style=\"color: #008080\"> 82 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 83 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> c() {\n<span style=\"color: #008080\"> 84 aLi[2].style.display = \"block\"\n<span style=\"color: #008080\"> 85 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 86 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> d() {\n<span style=\"color: #008080\"> 87 aLi[3].style.display = \"block\"\n<span style=\"color: #008080\"> 88 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 89 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> e() {\n<span style=\"color: #008080\"> 90 aLi[4].style.display = \"block\"\n<span style=\"color: #008080\"> 91 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 92 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> f() {\n<span style=\"color: #008080\"> 93 aLi[5].style.display = \"block\"\n<span style=\"color: #008080\"> 94 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 95 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> g() {\n<span style=\"color: #008080\"> 96 aLi[6].style.display = \"block\"\n<span style=\"color: #008080\"> 97 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\"> 98 <span style=\"color: #0000ff\">function<span style=\"color: #000000\"> h() {\n<span style=\"color: #008080\"> 99 aLi[7].style.display = \"block\"\n<span style=\"color: #008080\">100 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">101 $(<span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">102 <span style=\"color: #0000ff\">var Fireworks = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">103 <span style=\"color: #0000ff\">var self = <span style=\"color: #0000ff\">this<span style=\"color: #000000\">;\n<span style=\"color: #008080\">104 <span style=\"color: #0000ff\">var rand = <span style=\"color: #0000ff\">function(rMi, rMa){<span style=\"color: #0000ff\">return ~~((Math.random()*(rMa-rMi+1))+<span style=\"color: #000000\">rMi);}\n<span style=\"color: #008080\">105 <span style=\"color: #0000ff\">var hitTest = <span style=\"color: #0000ff\">function(x1, y1, w1, h1, x2, y2, w2, h2){<span style=\"color: #0000ff\">return !(x1 + w1 < x2 || x2 + w2 < x1 || y1 + h1 < y2 || y2 + h2 <<span style=\"color: #000000\"> y1);};\n<span style=\"color: #008080\">106 window.requestAnimFrame=<span style=\"color: #0000ff\">function(){<span style=\"color: #0000ff\">return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||<span style=\"color: #0000ff\">function(a){window.setTimeout(a,1E3\/60)}}();\n<span style=\"color: #008080\">107 \n<span style=\"color: #008080\">108 self.init = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">109 self.canvas = document.createElement('canvas'<span style=\"color: #000000\">);\n<span style=\"color: #008080\">110 self.canvas.width = self.cw =<span style=\"color: #000000\"> $(window).innerWidth();\n<span style=\"color: #008080\">111 self.canvas.height = self.ch =<span style=\"color: #000000\"> $(window).innerHeight();\n<span style=\"color: #008080\">112 self.particles =<span style=\"color: #000000\"> [];\n<span style=\"color: #008080\">113 self.partCount = 150<span style=\"color: #000000\">;\n<span style=\"color: #008080\">114 self.fireworks =<span style=\"color: #000000\"> [];\n<span style=\"color: #008080\">115 self.mx = self.cw\/2;\n<span style=\"color: #008080\">116 self.my = self.ch\/2;\n<span style=\"color: #008080\">117 self.currentHue = 30<span style=\"color: #000000\">;\n<span style=\"color: #008080\">118 self.partSpeed = 5<span style=\"color: #000000\">;\n<span style=\"color: #008080\">119 self.partSpeedVariance = 10<span style=\"color: #000000\">;\n<span style=\"color: #008080\">120 self.partWind = 50<span style=\"color: #000000\">;\n<span style=\"color: #008080\">121 self.partFriction = 5<span style=\"color: #000000\">;\n<span style=\"color: #008080\">122 self.partGravity = 1<span style=\"color: #000000\">;\n<span style=\"color: #008080\">123 self.hueMin = 0<span style=\"color: #000000\">;\n<span style=\"color: #008080\">124 self.hueMax = 360<span style=\"color: #000000\">;\n<span style=\"color: #008080\">125 self.fworkSpeed = 4<span style=\"color: #000000\">;\n<span style=\"color: #008080\">126 self.fworkAccel = 10<span style=\"color: #000000\">;\n<span style=\"color: #008080\">127 self.hueVariance = 30<span style=\"color: #000000\">;\n<span style=\"color: #008080\">128 self.flickerDensity = 25<span style=\"color: #000000\">;\n<span style=\"color: #008080\">129 self.showShockwave = <span style=\"color: #0000ff\">true<span style=\"color: #000000\">;\n<span style=\"color: #008080\">130 self.showTarget = <span style=\"color: #0000ff\">false<span style=\"color: #000000\">;\n<span style=\"color: #008080\">131 self.clearAlpha = 25<span style=\"color: #000000\">;\n<span style=\"color: #008080\">132 \n<span style=\"color: #008080\">133 <span style=\"color: #000000\"> $(document.body).append(self.canvas);\n<span style=\"color: #008080\">134 self.ctx = self.canvas.getContext('2d'<span style=\"color: #000000\">);\n<span style=\"color: #008080\">135 self.ctx.lineCap = 'round'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">136 self.ctx.lineJoin = 'round'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">137 self.lineWidth = 1<span style=\"color: #000000\">;\n<span style=\"color: #008080\">138 <span style=\"color: #000000\"> self.bindEvents();\n<span style=\"color: #008080\">139 <span style=\"color: #000000\"> self.canvasLoop();\n<span style=\"color: #008080\">140 \n<span style=\"color: #008080\">141 self.canvas.onselectstart = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">() {\n<span style=\"color: #008080\">142 <span style=\"color: #0000ff\">return <span style=\"color: #0000ff\">false<span style=\"color: #000000\">;\n<span style=\"color: #008080\">143 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">144 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">145 \n<span style=\"color: #008080\">146 self.createParticles = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(x,y, hue){\n<span style=\"color: #008080\">147 <span style=\"color: #0000ff\">var countdown =<span style=\"color: #000000\"> self.partCount;\n<span style=\"color: #008080\">148 <span style=\"color: #0000ff\">while(countdown--<span style=\"color: #000000\">){\n<span style=\"color: #008080\">149 <span style=\"color: #0000ff\">var newParticle =<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">150 <span style=\"color: #000000\"> x: x,\n<span style=\"color: #008080\">151 <span style=\"color: #000000\"> y: y,\n<span style=\"color: #008080\">152 <span style=\"color: #000000\"> coordLast: [\n<span style=\"color: #008080\">153 <span style=\"color: #000000\"> {x: x, y: y},\n<span style=\"color: #008080\">154 <span style=\"color: #000000\"> {x: x, y: y},\n<span style=\"color: #008080\">155 <span style=\"color: #000000\"> {x: x, y: y}\n<span style=\"color: #008080\">156 <span style=\"color: #000000\"> ],\n<span style=\"color: #008080\">157 angle: rand(0, 360<span style=\"color: #000000\">),\n<span style=\"color: #008080\">158 speed: rand(((self.partSpeed - self.partSpeedVariance) <= 0) ? 1 : self.partSpeed - self.partSpeedVariance, (self.partSpeed +<span style=\"color: #000000\"> self.partSpeedVariance)),\n<span style=\"color: #008080\">159 friction: 1 - self.partFriction\/100,\n<span style=\"color: #008080\">160 gravity: self.partGravity\/2,\n<span style=\"color: #008080\">161 hue: rand(hue-self.hueVariance, hue+<span style=\"color: #000000\">self.hueVariance),\n<span style=\"color: #008080\">162 brightness: rand(50, 80<span style=\"color: #000000\">),\n<span style=\"color: #008080\">163 alpha: rand(40,100)\/100,\n<span style=\"color: #008080\">164 decay: rand(10, 50)\/1000,\n<span style=\"color: #008080\">165 wind: (rand(0, self.partWind) - (self.partWind\/2))\/25<span style=\"color: #000000\">,\n<span style=\"color: #008080\">166 <span style=\"color: #000000\"> lineWidth: self.lineWidth\n<span style=\"color: #008080\">167 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">168 <span style=\"color: #000000\"> self.particles.push(newParticle);\n<span style=\"color: #008080\">169 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">170 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">171 \n<span style=\"color: #008080\">172 \n<span style=\"color: #008080\">173 self.updateParticles = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">174 <span style=\"color: #0000ff\">var i =<span style=\"color: #000000\"> self.particles.length;\n<span style=\"color: #008080\">175 <span style=\"color: #0000ff\">while(i--<span style=\"color: #000000\">){\n<span style=\"color: #008080\">176 <span style=\"color: #0000ff\">var p =<span style=\"color: #000000\"> self.particles[i];\n<span style=\"color: #008080\">177 <span style=\"color: #0000ff\">var radians = p.angle * Math.PI \/ 180<span style=\"color: #000000\">;\n<span style=\"color: #008080\">178 <span style=\"color: #0000ff\">var vx = Math.cos(radians) *<span style=\"color: #000000\"> p.speed;\n<span style=\"color: #008080\">179 <span style=\"color: #0000ff\">var vy = Math.sin(radians) *<span style=\"color: #000000\"> p.speed;\n<span style=\"color: #008080\">180 p.speed *=<span style=\"color: #000000\"> p.friction;\n<span style=\"color: #008080\">181 \n<span style=\"color: #008080\">182 p.coordLast[2].x = p.coordLast[1<span style=\"color: #000000\">].x;\n<span style=\"color: #008080\">183 p.coordLast[2].y = p.coordLast[1<span style=\"color: #000000\">].y;\n<span style=\"color: #008080\">184 p.coordLast[1].x = p.coordLast[0<span style=\"color: #000000\">].x;\n<span style=\"color: #008080\">185 p.coordLast[1].y = p.coordLast[0<span style=\"color: #000000\">].y;\n<span style=\"color: #008080\">186 p.coordLast[0].x =<span style=\"color: #000000\"> p.x;\n<span style=\"color: #008080\">187 p.coordLast[0].y =<span style=\"color: #000000\"> p.y;\n<span style=\"color: #008080\">188 \n<span style=\"color: #008080\">189 p.x +=<span style=\"color: #000000\"> vx;\n<span style=\"color: #008080\">190 p.y +=<span style=\"color: #000000\"> vy;\n<span style=\"color: #008080\">191 p.y +=<span style=\"color: #000000\"> p.gravity;\n<span style=\"color: #008080\">192 \n<span style=\"color: #008080\">193 p.angle +=<span style=\"color: #000000\"> p.wind;\n<span style=\"color: #008080\">194 p.alpha -=<span style=\"color: #000000\"> p.decay;\n<span style=\"color: #008080\">195 \n<span style=\"color: #008080\">196 <span style=\"color: #0000ff\">if(!hitTest(0,0,self.cw,self.ch,p.x-p.radius, p.y-p.radius, p.radius*2, p.radius*2) || p.alpha < .05<span style=\"color: #000000\">){\n<span style=\"color: #008080\">197 self.particles.splice(i, 1<span style=\"color: #000000\">);\n<span style=\"color: #008080\">198 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">199 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">200 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">201 \n<span style=\"color: #008080\">202 self.drawParticles = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">203 <span style=\"color: #0000ff\">var i =<span style=\"color: #000000\"> self.particles.length;\n<span style=\"color: #008080\">204 <span style=\"color: #0000ff\">while(i--<span style=\"color: #000000\">){\n<span style=\"color: #008080\">205 <span style=\"color: #0000ff\">var p =<span style=\"color: #000000\"> self.particles[i];\n<span style=\"color: #008080\">206 \n<span style=\"color: #008080\">207 <span style=\"color: #0000ff\">var coordRand = (rand(1,3)-1<span style=\"color: #000000\">);\n<span style=\"color: #008080\">208 <span style=\"color: #000000\"> self.ctx.beginPath();\n<span style=\"color: #008080\">209 <span style=\"color: #000000\"> self.ctx.moveTo(Math.round(p.coordLast[coordRand].x), Math.round(p.coordLast[coordRand].y));\n<span style=\"color: #008080\">210 <span style=\"color: #000000\"> self.ctx.lineTo(Math.round(p.x), Math.round(p.y));\n<span style=\"color: #008080\">211 <span style=\"color: #000000\"> self.ctx.closePath();\n<span style=\"color: #008080\">212 self.ctx.strokeStyle = 'hsla('+p.hue+', 100%, '+p.brightness+'%, '+p.alpha+')'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">213 <span style=\"color: #000000\"> self.ctx.stroke();\n<span style=\"color: #008080\">214 \n<span style=\"color: #008080\">215 <span style=\"color: #0000ff\">if(self.flickerDensity > 0<span style=\"color: #000000\">){\n<span style=\"color: #008080\">216 <span style=\"color: #0000ff\">var inverseDensity = 50 -<span style=\"color: #000000\"> self.flickerDensity;\n<span style=\"color: #008080\">217 <span style=\"color: #0000ff\">if(rand(0, inverseDensity) ===<span style=\"color: #000000\"> inverseDensity){\n<span style=\"color: #008080\">218 <span style=\"color: #000000\"> self.ctx.beginPath();\n<span style=\"color: #008080\">219 self.ctx.arc(Math.round(p.x), Math.round(p.y), rand(p.lineWidth,p.lineWidth+3)\/2, 0, Math.PI*2, false)\n<span style=\"color: #008080\">220 <span style=\"color: #000000\"> self.ctx.closePath();\n<span style=\"color: #008080\">221 <span style=\"color: #0000ff\">var randAlpha = rand(50,100)\/100;\n<span style=\"color: #008080\">222 self.ctx.fillStyle = 'hsla('+p.hue+', 100%, '+p.brightness+'%, '+randAlpha+')'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">223 <span style=\"color: #000000\"> self.ctx.fill();\n<span style=\"color: #008080\">224 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">225 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">226 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">227 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">228 \n<span style=\"color: #008080\">229 \n<span style=\"color: #008080\">230 self.createFireworks = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(startX, startY, targetX, targetY){\n<span style=\"color: #008080\">231 <span style=\"color: #0000ff\">var newFirework =<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">232 <span style=\"color: #000000\"> x: startX,\n<span style=\"color: #008080\">233 <span style=\"color: #000000\"> y: startY,\n<span style=\"color: #008080\">234 <span style=\"color: #000000\"> startX: startX,\n<span style=\"color: #008080\">235 <span style=\"color: #000000\"> startY: startY,\n<span style=\"color: #008080\">236 hitX: <span style=\"color: #0000ff\">false<span style=\"color: #000000\">,\n<span style=\"color: #008080\">237 hitY: <span style=\"color: #0000ff\">false<span style=\"color: #000000\">,\n<span style=\"color: #008080\">238 <span style=\"color: #000000\"> coordLast: [\n<span style=\"color: #008080\">239 <span style=\"color: #000000\"> {x: startX, y: startY},\n<span style=\"color: #008080\">240 <span style=\"color: #000000\"> {x: startX, y: startY},\n<span style=\"color: #008080\">241 <span style=\"color: #000000\"> {x: startX, y: startY}\n<span style=\"color: #008080\">242 <span style=\"color: #000000\"> ],\n<span style=\"color: #008080\">243 <span style=\"color: #000000\"> targetX: targetX,\n<span style=\"color: #008080\">244 <span style=\"color: #000000\"> targetY: targetY,\n<span style=\"color: #008080\">245 <span style=\"color: #000000\"> speed: self.fworkSpeed,\n<span style=\"color: #008080\">246 angle: Math.atan2(targetY - startY, targetX -<span style=\"color: #000000\"> startX),\n<span style=\"color: #008080\">247 shockwaveAngle: Math.atan2(targetY - startY, targetX - startX)+(90*(Math.PI\/180)),\n<span style=\"color: #008080\">248 acceleration: self.fworkAccel\/100,\n<span style=\"color: #008080\">249 <span style=\"color: #000000\"> hue: self.currentHue,\n<span style=\"color: #008080\">250 brightness: rand(50, 80<span style=\"color: #000000\">),\n<span style=\"color: #008080\">251 alpha: rand(50,100)\/100,\n<span style=\"color: #008080\">252 <span style=\"color: #000000\"> lineWidth: self.lineWidth\n<span style=\"color: #008080\">253 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">254 <span style=\"color: #000000\"> self.fireworks.push(newFirework);\n<span style=\"color: #008080\">255 \n<span style=\"color: #008080\">256 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">257 \n<span style=\"color: #008080\">258 \n<span style=\"color: #008080\">259 self.updateFireworks = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">260 <span style=\"color: #0000ff\">var i =<span style=\"color: #000000\"> self.fireworks.length;\n<span style=\"color: #008080\">261 \n<span style=\"color: #008080\">262 <span style=\"color: #0000ff\">while(i--<span style=\"color: #000000\">){\n<span style=\"color: #008080\">263 <span style=\"color: #0000ff\">var f =<span style=\"color: #000000\"> self.fireworks[i];\n<span style=\"color: #008080\">264 self.ctx.lineWidth =<span style=\"color: #000000\"> f.lineWidth;\n<span style=\"color: #008080\">265 \n<span style=\"color: #008080\">266 vx = Math.cos(f.angle) *<span style=\"color: #000000\"> f.speed,\n<span style=\"color: #008080\">267 vy = Math.sin(f.angle) *<span style=\"color: #000000\"> f.speed;\n<span style=\"color: #008080\">268 f.speed *= 1 +<span style=\"color: #000000\"> f.acceleration;\n<span style=\"color: #008080\">269 f.coordLast[2].x = f.coordLast[1<span style=\"color: #000000\">].x;\n<span style=\"color: #008080\">270 f.coordLast[2].y = f.coordLast[1<span style=\"color: #000000\">].y;\n<span style=\"color: #008080\">271 f.coordLast[1].x = f.coordLast[0<span style=\"color: #000000\">].x;\n<span style=\"color: #008080\">272 f.coordLast[1].y = f.coordLast[0<span style=\"color: #000000\">].y;\n<span style=\"color: #008080\">273 f.coordLast[0].x =<span style=\"color: #000000\"> f.x;\n<span style=\"color: #008080\">274 f.coordLast[0].y =<span style=\"color: #000000\"> f.y;\n<span style=\"color: #008080\">275 \n<span style=\"color: #008080\">276 <span style=\"color: #0000ff\">if(f.startX >=<span style=\"color: #000000\"> f.targetX){\n<span style=\"color: #008080\">277 <span style=\"color: #0000ff\">if(f.x + vx <=<span style=\"color: #000000\"> f.targetX){\n<span style=\"color: #008080\">278 f.x =<span style=\"color: #000000\"> f.targetX;\n<span style=\"color: #008080\">279 f.hitX = <span style=\"color: #0000ff\">true<span style=\"color: #000000\">;\n<span style=\"color: #008080\">280 } <span style=\"color: #0000ff\">else<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">281 f.x +=<span style=\"color: #000000\"> vx;\n<span style=\"color: #008080\">282 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">283 } <span style=\"color: #0000ff\">else<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">284 <span style=\"color: #0000ff\">if(f.x + vx >=<span style=\"color: #000000\"> f.targetX){\n<span style=\"color: #008080\">285 f.x =<span style=\"color: #000000\"> f.targetX;\n<span style=\"color: #008080\">286 f.hitX = <span style=\"color: #0000ff\">true<span style=\"color: #000000\">;\n<span style=\"color: #008080\">287 } <span style=\"color: #0000ff\">else<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">288 f.x +=<span style=\"color: #000000\"> vx;\n<span style=\"color: #008080\">289 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">290 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">291 \n<span style=\"color: #008080\">292 <span style=\"color: #0000ff\">if(f.startY >=<span style=\"color: #000000\"> f.targetY){\n<span style=\"color: #008080\">293 <span style=\"color: #0000ff\">if(f.y + vy <=<span style=\"color: #000000\"> f.targetY){\n<span style=\"color: #008080\">294 f.y =<span style=\"color: #000000\"> f.targetY;\n<span style=\"color: #008080\">295 f.hitY = <span style=\"color: #0000ff\">true<span style=\"color: #000000\">;\n<span style=\"color: #008080\">296 } <span style=\"color: #0000ff\">else<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">297 f.y +=<span style=\"color: #000000\"> vy;\n<span style=\"color: #008080\">298 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">299 } <span style=\"color: #0000ff\">else<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">300 <span style=\"color: #0000ff\">if(f.y + vy >=<span style=\"color: #000000\"> f.targetY){\n<span style=\"color: #008080\">301 f.y =<span style=\"color: #000000\"> f.targetY;\n<span style=\"color: #008080\">302 f.hitY = <span style=\"color: #0000ff\">true<span style=\"color: #000000\">;\n<span style=\"color: #008080\">303 } <span style=\"color: #0000ff\">else<span style=\"color: #000000\"> {\n<span style=\"color: #008080\">304 f.y +=<span style=\"color: #000000\"> vy;\n<span style=\"color: #008080\">305 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">306 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">307 \n<span style=\"color: #008080\">308 <span style=\"color: #0000ff\">if(f.hitX &&<span style=\"color: #000000\"> f.hitY){\n<span style=\"color: #008080\">309 <span style=\"color: #000000\"> self.createParticles(f.targetX, f.targetY, f.hue);\n<span style=\"color: #008080\">310 self.fireworks.splice(i, 1<span style=\"color: #000000\">);\n<span style=\"color: #008080\">311 \n<span style=\"color: #008080\">312 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">313 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">314 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">315 \n<span style=\"color: #008080\">316 self.drawFireworks = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">317 <span style=\"color: #0000ff\">var i =<span style=\"color: #000000\"> self.fireworks.length;\n<span style=\"color: #008080\">318 self.ctx.globalCompositeOperation = 'lighter'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">319 <span style=\"color: #0000ff\">while(i--<span style=\"color: #000000\">){\n<span style=\"color: #008080\">320 <span style=\"color: #0000ff\">var f =<span style=\"color: #000000\"> self.fireworks[i];\n<span style=\"color: #008080\">321 self.ctx.lineWidth =<span style=\"color: #000000\"> f.lineWidth;\n<span style=\"color: #008080\">322 \n<span style=\"color: #008080\">323 <span style=\"color: #0000ff\">var coordRand = (rand(1,3)-1<span style=\"color: #000000\">);\n<span style=\"color: #008080\">324 <span style=\"color: #000000\"> self.ctx.beginPath();\n<span style=\"color: #008080\">325 <span style=\"color: #000000\"> self.ctx.moveTo(Math.round(f.coordLast[coordRand].x), Math.round(f.coordLast[coordRand].y));\n<span style=\"color: #008080\">326 <span style=\"color: #000000\"> self.ctx.lineTo(Math.round(f.x), Math.round(f.y));\n<span style=\"color: #008080\">327 <span style=\"color: #000000\"> self.ctx.closePath();\n<span style=\"color: #008080\">328 self.ctx.strokeStyle = 'hsla('+f.hue+', 100%, '+f.brightness+'%, '+f.alpha+')'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">329 <span style=\"color: #000000\"> self.ctx.stroke();\n<span style=\"color: #008080\">330 \n<span style=\"color: #008080\">331 <span style=\"color: #0000ff\">if<span style=\"color: #000000\">(self.showTarget){\n<span style=\"color: #008080\">332 <span style=\"color: #000000\"> self.ctx.save();\n<span style=\"color: #008080\">333 <span style=\"color: #000000\"> self.ctx.beginPath();\n<span style=\"color: #008080\">334 self.ctx.arc(Math.round(f.targetX), Math.round(f.targetY), rand(1,8), 0, Math.PI*2, <span style=\"color: #0000ff\">false<span style=\"color: #000000\">)\n<span style=\"color: #008080\">335 <span style=\"color: #000000\"> self.ctx.closePath();\n<span style=\"color: #008080\">336 self.ctx.lineWidth = 1<span style=\"color: #000000\">;\n<span style=\"color: #008080\">337 <span style=\"color: #000000\"> self.ctx.stroke();\n<span style=\"color: #008080\">338 <span style=\"color: #000000\"> self.ctx.restore();\n<span style=\"color: #008080\">339 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">340 \n<span style=\"color: #008080\">341 <span style=\"color: #0000ff\">if<span style=\"color: #000000\">(self.showShockwave){\n<span style=\"color: #008080\">342 <span style=\"color: #000000\"> self.ctx.save();\n<span style=\"color: #008080\">343 <span style=\"color: #000000\"> self.ctx.translate(Math.round(f.x), Math.round(f.y));\n<span style=\"color: #008080\">344 <span style=\"color: #000000\"> self.ctx.rotate(f.shockwaveAngle);\n<span style=\"color: #008080\">345 <span style=\"color: #000000\"> self.ctx.beginPath();\n<span style=\"color: #008080\">346 self.ctx.arc(0, 0, 1*(f.speed\/5), 0, Math.PI, true);\n<span style=\"color: #008080\">347 self.ctx.strokeStyle = 'hsla('+f.hue+', 100%, '+f.brightness+'%, '+rand(25, 60)\/100+')';\n<span style=\"color: #008080\">348 self.ctx.lineWidth =<span style=\"color: #000000\"> f.lineWidth;\n<span style=\"color: #008080\">349 <span style=\"color: #000000\"> self.ctx.stroke();\n<span style=\"color: #008080\">350 <span style=\"color: #000000\"> self.ctx.restore();\n<span style=\"color: #008080\">351 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">352 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">353 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">354 \n<span style=\"color: #008080\">355 self.bindEvents = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">356 $(window).on('resize', <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">357 <span style=\"color: #000000\"> clearTimeout(self.timeout);\n<span style=\"color: #008080\">358 self.timeout = setTimeout(<span style=\"color: #0000ff\">function<span style=\"color: #000000\">() {\n<span style=\"color: #008080\">359 self.canvas.width = self.cw =<span style=\"color: #000000\"> $(window).innerWidth();\n<span style=\"color: #008080\">360 self.canvas.height = self.ch =<span style=\"color: #000000\"> $(window).innerHeight();\n<span style=\"color: #008080\">361 self.ctx.lineCap = 'round'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">362 self.ctx.lineJoin = 'round'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">363 }, 100<span style=\"color: #000000\">);\n<span style=\"color: #008080\">364 <span style=\"color: #000000\"> });\n<span style=\"color: #008080\">365 \n<span style=\"color: #008080\">366 $(self.canvas).on('mousedown', <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(e){\n<span style=\"color: #008080\">367 self.mx = e.pageX -<span style=\"color: #000000\"> self.canvas.offsetLeft;\n<span style=\"color: #008080\">368 self.my = e.pageY -<span style=\"color: #000000\"> self.canvas.offsetTop;\n<span style=\"color: #008080\">369 self.currentHue =<span style=\"color: #000000\"> rand(self.hueMin, self.hueMax);\n<span style=\"color: #008080\">370 self.createFireworks(self.cw\/2, self.ch, self.mx, self.my);\n<span style=\"color: #008080\">371 \n<span style=\"color: #008080\">372 $(self.canvas).on('mousemove.fireworks', <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(e){\n<span style=\"color: #008080\">373 self.mx = e.pageX -<span style=\"color: #000000\"> self.canvas.offsetLeft;\n<span style=\"color: #008080\">374 self.my = e.pageY -<span style=\"color: #000000\"> self.canvas.offsetTop;\n<span style=\"color: #008080\">375 self.currentHue =<span style=\"color: #000000\"> rand(self.hueMin, self.hueMax);\n<span style=\"color: #008080\">376 self.createFireworks(self.cw\/2, self.ch, self.mx, self.my);\n<span style=\"color: #008080\">377 <span style=\"color: #000000\"> });\n<span style=\"color: #008080\">378 <span style=\"color: #000000\"> });\n<span style=\"color: #008080\">379 \n<span style=\"color: #008080\">380 $(self.canvas).on('mouseup', <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(e){\n<span style=\"color: #008080\">381 $(self.canvas).off('mousemove.fireworks'<span style=\"color: #000000\">);\n<span style=\"color: #008080\">382 <span style=\"color: #000000\"> });\n<span style=\"color: #008080\">383 \n<span style=\"color: #008080\">384 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">385 \n<span style=\"color: #008080\">386 self.clear = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">387 self.particles =<span style=\"color: #000000\"> [];\n<span style=\"color: #008080\">388 self.fireworks =<span style=\"color: #000000\"> [];\n<span style=\"color: #008080\">389 self.ctx.clearRect(0, 0<span style=\"color: #000000\">, self.cw, self.ch);\n<span style=\"color: #008080\">390 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">391 \n<span style=\"color: #008080\">392 \n<span style=\"color: #008080\">393 self.canvasLoop = <span style=\"color: #0000ff\">function<span style=\"color: #000000\">(){\n<span style=\"color: #008080\">394 <span style=\"color: #000000\"> requestAnimFrame(self.canvasLoop, self.canvas);\n<span style=\"color: #008080\">395 self.ctx.globalCompositeOperation = 'destination-out'<span style=\"color: #000000\">;\n<span style=\"color: #008080\">396 self.ctx.fillStyle = 'rgba(0,0,0,'+self.clearAlpha\/100+')';\n<span style=\"color: #008080\">397 self.ctx.fillRect(0,0<span style=\"color: #000000\">,self.cw,self.ch);\n<span style=\"color: #008080\">398 <span style=\"color: #000000\"> self.updateFireworks();\n<span style=\"color: #008080\">399 <span style=\"color: #000000\"> self.updateParticles();\n<span style=\"color: #008080\">400 <span style=\"color: #000000\"> self.drawFireworks();\n<span style=\"color: #008080\">401 <span style=\"color: #000000\"> self.drawParticles();\n<span style=\"color: #008080\">402 \n<span style=\"color: #008080\">403 <span style=\"color: #000000\"> };\n<span style=\"color: #008080\">404 \n<span style=\"color: #008080\">405 <span style=\"color: #000000\"> self.init();\n<span style=\"color: #008080\">406 \n<span style=\"color: #008080\">407 <span style=\"color: #000000\"> }\n<span style=\"color: #008080\">408 <span style=\"color: #0000ff\">var fworks = <span style=\"color: #0000ff\">new<span style=\"color: #000000\"> Fireworks();\n<span style=\"color: #008080\">409 \n<span style=\"color: #008080\">410 <span style=\"color: #000000\"> });\n<span style=\"color: #008080\">411 \n<span style=\"color: #008080\">412 <\/script>\n<span style=\"color: #008080\">413<\/span> \n<span style=\"color: #008080\">414<\/span> \n<span style=\"color: #008080\">415<\/span> <\/pre>\n<\/div>\n<p>廣大網友們!因為這是放假的時候老師給發的!所以我也看不太懂有些東西!實在是抱歉  有什麼不明白的,就留言告訴我!我去找我曾經的老師問問,雖然他已經退休好久了!!<\/p>"}</script><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/","name":"首頁"}},{"@type":"ListItem","position":2,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/web-designer.html","name":"web前端"}},{"@type":"ListItem","position":3,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/js-tutorial.html","name":"js教程"}},{"@type":"ListItem","position":4,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/faq\/369620.html","name":"JQuery和html+css實作滑鼠點擊放煙火"}}]}</script></head><body><div class="bodyBg"><link rel="stylesheet" type="text/css" href="/static/csshwm/m_stylehw.css"><header><div class="head"><div class="haed_left"><div class="haed_logo"><a href="https://m.php.cn/zh-tw/" title="PHP中文網" class="haed_logo_a"><img src="/static/imghwm/logo.png" alt="PHP中文網" class="haed_logoimg"></a></div></div><div class="search_div search_div_top2"><input id="key_words" class="search-input" type="text" autocomplete="off" name="keywords" required="required" placeholder="Block,address,transaction,news" value="" onkeydown="if (event.keyCode == 13) searchs('zh-tw')"/><a onclick="searchs('zh-tw')" href="javascript:;" title="搜尋"><img onerror="this.onerror=''; this.src='static/imghwm/default1.png'" src="/static/imghwm/find.png" alt="搜尋"></a></div><div class="head_right"><button type="button" class="layui-btn layui-btn-primary headerlan headlanmax lan1" id="lan1sp" lay-on="test-offset-r"><img src="/static/imghwm/m_menu.png" alt=""></button><div id="m_menu" class="m_menu" style="display: none;"><div class="m_editormain12main_top"><img src="/static/imghwm/logo.png" alt="logo"><a href="javascript:;" class="m_editormain12main_topi" id="m_editormain12main_topi_sp"><i class="layui-icon layui-icon-close"></i></a></div><div class="layui-panel m_menu_main"><ul class="layui-menu" id="demo-menu"><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">社群<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/article.html" title="文章">文章</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/faq/zt" title="合集">合集</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/wenda.html" title="問答">問答</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">學習<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/course.html" title="課程">課程</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/dic/29.html" title="程式設計字典">程式設計字典</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">工具庫<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/development-tools" title="開發工具">開發工具</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/website-source-code" title="網站源碼">網站源碼</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/php-libraries" title="PHP 函式庫">PHP 函式庫</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/js-special-effects" title="JS特效">JS特效</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/website-materials" title="網站素材">網站素材</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/extension-plug-ins" title="擴充插件">擴充插件</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li lay-options="{id: 100}"><div class="layui-menu-body-title m_menus_oth"><a href="https://m.php.cn/zh-tw/ai" title="AI工具">AI工具</a></div></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">休閒<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/game" title="遊戲下載">遊戲下載</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/mobile-game-tutorial/" title="遊戲教程">遊戲教程</a></div></li></ul></li><li class="layui-menu-item-divider"></li></ul></div><!-- <div class="m_menu_button">--><!-- <a href="javascript:;" title="singup">Create an account</a>--><!-- </div>--><div class="m_menu_button m_menu_button_login"><a href="https://m.php.cn/zh-tw/login" title="Login">Log in</a></div><div class="m_menu_button m_menu_button_lang"><button type="button" class="layui-btn layui-btn-primary headerlan headlanmax lan1" id="lan1" lay-on="page2">繁体中文<i class="layui-icon layui-icon-triangle-d"></i></button></div></div><div class="m_menu_lang" id="m_menu_lang" style="display: none;"><div class="m_editormain12main_top"><img src="/static/imghwm/logo.png" alt="logo"><a href="javascript:;" class="m_editormain12main_topi" id="m_editormain12main_topi_lan"><i class="layui-icon layui-icon-close"></i></a></div><div class="m_menu_lang_main"><a href="javascript:setlang('zh-cn');" class="m_menu_lang_mains">简体中文<span>zh-cn</span></a><a href="javascript:setlang('en');" class="m_menu_lang_mains">English<span>en</span></a><a href="javascript:;" class="m_menu_lang_mains">繁体中文<span>zh-tw</span></a><a href="javascript:setlang('ja');" class="m_menu_lang_mains">日本語<span>ja</span></a><a href="javascript:setlang('ko');" class="m_menu_lang_mains">한국어<span>ko</span></a><a href="javascript:setlang('ms');" class="m_menu_lang_mains">Melayu<span>ms</span></a><a href="javascript:setlang('fr');" class="m_menu_lang_mains">Français<span>fr</span></a><a href="javascript:setlang('de');" class="m_menu_lang_mains">Deutsch<span>de</span></a></div></div></div></div></header><script> document.getElementById('lan1sp').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'block'; } }); document.getElementById('m_editormain12main_topi_sp').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'none'; } }); document.getElementById('lan1').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu_lang'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'block'; } }); document.getElementById('m_editormain12main_topi_lan').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu_lang'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'none'; } }); </script><div class="bodyMain"><!--所在位置--><div class="nphpSize"><div class="nphpSizeIn"><b></b><p><a href="https://m.php.cn/zh-tw/" title="首頁" class="bBlack">首頁</a> ><a href="https://m.php.cn/zh-tw/web-designer.html" class="cBlack">web前端</a> ><a href="https://m.php.cn/zh-tw/js-tutorial.html" class="cBlack">js教程</a> >JQuery和html+css實作滑鼠點擊放煙火</p><!-- <p><a href="https://m.php.cn/zh-tw/article.html" class="cBlack">科技文章</a>  >  <a href="https://m.php.cn/zh-tw/web-designer.html" class="cBlack">web前端</a> > <a href="https://m.php.cn/zh-tw/js-tutorial.html" class="cBlack">js教程</a> > JQuery和html+css實作滑鼠點擊放煙火</p> --><div class="clear"></div></div></div><div class="nphpQianBox"><div class="nphpQianTitle"><h1>JQuery和html+css實作滑鼠點擊放煙火</h1><div class="nphpQianTitleIn"><span><img data-src="https://img.php.cn/upload/avatar/000/000/001/6251028808086368.png" alt="PHP中文网" class="lazyload" src="/static/front/mobimages/moren/moren.png" /></span><dl><dt><em>PHP中文网</em><i class='bg1'>原創</i><div class="clear"></div></dt><dd><em>2017-06-20 09:36:00</em><i>1622瀏覽</i><div class="clear"></div></dd></dl><div class="clear"></div></div></div><div class="nphpQianCont wenda-list"><div class="cnblogs_code"> <pre class="brush:php;toolbar:false"><span style="color: #008080"> 1</span> <span style="color: #008080"> 2</span> <span style="color: #008080"> 3</span> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <span style="color: #008080"> 4</span> <title>HTML5烟花燃放特效代码</title> <span style="color: #008080"> 5</span> <span style="color: #008080"> 6</span> <style> <span style="color: #008080"> 7 html,body{height:100%;margin:0;padding:0<span style="color: #000000">} <span style="color: #008080"> 8 ul,li{text-indent:0;text-decoration:none;margin:0;padding:0<span style="color: #000000">} <span style="color: #008080"> 9 img{border:0<span style="color: #000000">} <span style="color: #008080"> 10 body{background-color:#000;color:#999;font:100%/18px helvetica, arial, sans-serif} <span style="color: #008080"> 11 canvas{cursor:crosshair;display:block;left:0;position:absolute;top:0;z-index:20<span style="color: #000000">} <span style="color: #008080"> 12 *<span style="color: #000000">{ <span style="color: #008080"> 13 <span style="color: #000000"> margin: 0px; <span style="color: #008080"> 14 <span style="color: #000000"> padding: 0px; <span style="color: #008080"> 15 <span style="color: #000000"> } <span style="color: #008080"> 16 <span style="color: #000000"> #bg_Img{ <span style="color: #008080"> 17 <span style="color: #000000"> width: 1920px; <span style="color: #008080"> 18 <span style="color: #000000"> height: 1500px; <span style="color: #008080"> 19 <span style="color: #000000"> border: 1px solid transparent; <span style="color: #008080"> 20 background: url("start.gif"<span style="color: #000000">) repeat; <span style="color: #008080"> 21 text-<span style="color: #000000">align: center; <span style="color: #008080"> 22 <span style="color: #000000"> } <span style="color: #008080"> 23 <span style="color: #000000"> ul{ <span style="color: #008080"> 24 <span style="color: #000000"> width: 5555px; <span style="color: #008080"> 25 <span style="color: #000000"> height: 200px; <span style="color: #008080"> 26 <span style="color: #000000"> } <span style="color: #008080"> 27 <span style="color: #000000"> li{ <span style="color: #008080"> 28 font: 120px/190px "楷体"; <span style="color: #008080"> 29 <span style="color: #000000"> color: white; <span style="color: #008080"> 30 text-<span style="color: #000000">shadow: 5px 10px 10px 10px; <span style="color: #008080"> 31 list-<span style="color: #000000">style: none; <span style="color: #008080"> 32 <span style="color: #0000ff">float<span style="color: #000000">: left; <span style="color: #008080"> 33 <span style="color: #000000"> display: none; <span style="color: #008080"> 34 <span style="color: #000000"> } <span style="color: #008080"> 35 <span style="color: #000000"> #text_bd{ <span style="color: #008080"> 36 <span style="color: #000000"> width: 600px; <span style="color: #008080"> 37 <span style="color: #000000"> height: 200px; <span style="color: #008080"> 38 <span style="color: #000000"> border: 5px solid transparent; <span style="color: #008080"> 39 margin-<span style="color: #000000">left: 200px; <span style="color: #008080"> 40 <span style="color: #000000"> } <span style="color: #008080"> 41 <span style="color: #000000"> #mouse_click{ <span style="color: #008080"> 42 <span style="color: #000000"> margin: 0px auto; <span style="color: #008080"> 43 text-<span style="color: #000000">align: center; <span style="color: #008080"> 44 <span style="color: #000000"> color: white; <span style="color: #008080"> 45 <span style="color: #000000"> } <span style="color: #008080"> 46 </style> <span style="color: #008080"> 47</span> <span style="color: #008080"> 48</span> <span style="color: #008080"> 49</span> <span style="color: #008080"> 50</span> <div id="bg_Img"> <span style="color: #008080"> 51</span> <div id="text_bd"> <span style="color: #008080"> 52</span> <ul> <span style="color: #008080"> 53</span> <li>O(∩_∩)O~~</li> <span style="color: #008080"> 54</span> <li>同</li> <span style="color: #008080"> 55</span> <li>学</li> <span style="color: #008080"> 56</span> <li>们</li> <span style="color: #008080"> 57</span> <li>节</li> <span style="color: #008080"> 58</span> <li>日</li> <span style="color: #008080"> 59</span> <li>快</li> <span style="color: #008080"> 60</span> <li>乐</li> <span style="color: #008080"> 61</span> <li>~~</li> <span style="color: #008080"> 62</span> </ul> <span style="color: #008080"> 63</span> </div> <span style="color: #008080"> 64</span> <div id="mouse_click">鼠标点击释放烟花效果</div> <span style="color: #008080"> 65</span> </div> <span style="color: #008080"> 66</span> <script type="text/javascript" src="jquery-3.1.1.js"></script> <span style="color: #008080"> 67</span> <script type="text/javascript"> <span style="color: #008080"> 68 <span style="color: #0000ff">var aLi=document.querySelectorAll("li"<span style="color: #000000">); <span style="color: #008080"> 69 setInterval(a,1000<span style="color: #000000">); <span style="color: #008080"> 70 setInterval(b,2000<span style="color: #000000">); <span style="color: #008080"> 71 setInterval(c,3000<span style="color: #000000">); <span style="color: #008080"> 72 setInterval(d,4000<span style="color: #000000">); <span style="color: #008080"> 73 setInterval(e,5000<span style="color: #000000">); <span style="color: #008080"> 74 setInterval(f,6000<span style="color: #000000">); <span style="color: #008080"> 75 setInterval(g,7000<span style="color: #000000">); <span style="color: #008080"> 76 setInterval(h,8000<span style="color: #000000">); <span style="color: #008080"> 77 <span style="color: #0000ff">function<span style="color: #000000"> a() { <span style="color: #008080"> 78 aLi[0].style.display = "block" <span style="color: #008080"> 79 <span style="color: #000000"> } <span style="color: #008080"> 80 <span style="color: #0000ff">function<span style="color: #000000"> b() { <span style="color: #008080"> 81 aLi[1].style.display = "block" <span style="color: #008080"> 82 <span style="color: #000000"> } <span style="color: #008080"> 83 <span style="color: #0000ff">function<span style="color: #000000"> c() { <span style="color: #008080"> 84 aLi[2].style.display = "block" <span style="color: #008080"> 85 <span style="color: #000000"> } <span style="color: #008080"> 86 <span style="color: #0000ff">function<span style="color: #000000"> d() { <span style="color: #008080"> 87 aLi[3].style.display = "block" <span style="color: #008080"> 88 <span style="color: #000000"> } <span style="color: #008080"> 89 <span style="color: #0000ff">function<span style="color: #000000"> e() { <span style="color: #008080"> 90 aLi[4].style.display = "block" <span style="color: #008080"> 91 <span style="color: #000000"> } <span style="color: #008080"> 92 <span style="color: #0000ff">function<span style="color: #000000"> f() { <span style="color: #008080"> 93 aLi[5].style.display = "block" <span style="color: #008080"> 94 <span style="color: #000000"> } <span style="color: #008080"> 95 <span style="color: #0000ff">function<span style="color: #000000"> g() { <span style="color: #008080"> 96 aLi[6].style.display = "block" <span style="color: #008080"> 97 <span style="color: #000000"> } <span style="color: #008080"> 98 <span style="color: #0000ff">function<span style="color: #000000"> h() { <span style="color: #008080"> 99 aLi[7].style.display = "block" <span style="color: #008080">100 <span style="color: #000000"> } <span style="color: #008080">101 $(<span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">102 <span style="color: #0000ff">var Fireworks = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">103 <span style="color: #0000ff">var self = <span style="color: #0000ff">this<span style="color: #000000">; <span style="color: #008080">104 <span style="color: #0000ff">var rand = <span style="color: #0000ff">function(rMi, rMa){<span style="color: #0000ff">return ~~((Math.random()*(rMa-rMi+1))+<span style="color: #000000">rMi);} <span style="color: #008080">105 <span style="color: #0000ff">var hitTest = <span style="color: #0000ff">function(x1, y1, w1, h1, x2, y2, w2, h2){<span style="color: #0000ff">return !(x1 + w1 < x2 || x2 + w2 < x1 || y1 + h1 < y2 || y2 + h2 <<span style="color: #000000"> y1);}; <span style="color: #008080">106 window.requestAnimFrame=<span style="color: #0000ff">function(){<span style="color: #0000ff">return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||<span style="color: #0000ff">function(a){window.setTimeout(a,1E3/60)}}(); <span style="color: #008080">107 <span style="color: #008080">108 self.init = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">109 self.canvas = document.createElement('canvas'<span style="color: #000000">); <span style="color: #008080">110 self.canvas.width = self.cw =<span style="color: #000000"> $(window).innerWidth(); <span style="color: #008080">111 self.canvas.height = self.ch =<span style="color: #000000"> $(window).innerHeight(); <span style="color: #008080">112 self.particles =<span style="color: #000000"> []; <span style="color: #008080">113 self.partCount = 150<span style="color: #000000">; <span style="color: #008080">114 self.fireworks =<span style="color: #000000"> []; <span style="color: #008080">115 self.mx = self.cw/2; <span style="color: #008080">116 self.my = self.ch/2; <span style="color: #008080">117 self.currentHue = 30<span style="color: #000000">; <span style="color: #008080">118 self.partSpeed = 5<span style="color: #000000">; <span style="color: #008080">119 self.partSpeedVariance = 10<span style="color: #000000">; <span style="color: #008080">120 self.partWind = 50<span style="color: #000000">; <span style="color: #008080">121 self.partFriction = 5<span style="color: #000000">; <span style="color: #008080">122 self.partGravity = 1<span style="color: #000000">; <span style="color: #008080">123 self.hueMin = 0<span style="color: #000000">; <span style="color: #008080">124 self.hueMax = 360<span style="color: #000000">; <span style="color: #008080">125 self.fworkSpeed = 4<span style="color: #000000">; <span style="color: #008080">126 self.fworkAccel = 10<span style="color: #000000">; <span style="color: #008080">127 self.hueVariance = 30<span style="color: #000000">; <span style="color: #008080">128 self.flickerDensity = 25<span style="color: #000000">; <span style="color: #008080">129 self.showShockwave = <span style="color: #0000ff">true<span style="color: #000000">; <span style="color: #008080">130 self.showTarget = <span style="color: #0000ff">false<span style="color: #000000">; <span style="color: #008080">131 self.clearAlpha = 25<span style="color: #000000">; <span style="color: #008080">132 <span style="color: #008080">133 <span style="color: #000000"> $(document.body).append(self.canvas); <span style="color: #008080">134 self.ctx = self.canvas.getContext('2d'<span style="color: #000000">); <span style="color: #008080">135 self.ctx.lineCap = 'round'<span style="color: #000000">; <span style="color: #008080">136 self.ctx.lineJoin = 'round'<span style="color: #000000">; <span style="color: #008080">137 self.lineWidth = 1<span style="color: #000000">; <span style="color: #008080">138 <span style="color: #000000"> self.bindEvents(); <span style="color: #008080">139 <span style="color: #000000"> self.canvasLoop(); <span style="color: #008080">140 <span style="color: #008080">141 self.canvas.onselectstart = <span style="color: #0000ff">function<span style="color: #000000">() { <span style="color: #008080">142 <span style="color: #0000ff">return <span style="color: #0000ff">false<span style="color: #000000">; <span style="color: #008080">143 <span style="color: #000000"> }; <span style="color: #008080">144 <span style="color: #000000"> }; <span style="color: #008080">145 <span style="color: #008080">146 self.createParticles = <span style="color: #0000ff">function<span style="color: #000000">(x,y, hue){ <span style="color: #008080">147 <span style="color: #0000ff">var countdown =<span style="color: #000000"> self.partCount; <span style="color: #008080">148 <span style="color: #0000ff">while(countdown--<span style="color: #000000">){ <span style="color: #008080">149 <span style="color: #0000ff">var newParticle =<span style="color: #000000"> { <span style="color: #008080">150 <span style="color: #000000"> x: x, <span style="color: #008080">151 <span style="color: #000000"> y: y, <span style="color: #008080">152 <span style="color: #000000"> coordLast: [ <span style="color: #008080">153 <span style="color: #000000"> {x: x, y: y}, <span style="color: #008080">154 <span style="color: #000000"> {x: x, y: y}, <span style="color: #008080">155 <span style="color: #000000"> {x: x, y: y} <span style="color: #008080">156 <span style="color: #000000"> ], <span style="color: #008080">157 angle: rand(0, 360<span style="color: #000000">), <span style="color: #008080">158 speed: rand(((self.partSpeed - self.partSpeedVariance) <= 0) ? 1 : self.partSpeed - self.partSpeedVariance, (self.partSpeed +<span style="color: #000000"> self.partSpeedVariance)), <span style="color: #008080">159 friction: 1 - self.partFriction/100, <span style="color: #008080">160 gravity: self.partGravity/2, <span style="color: #008080">161 hue: rand(hue-self.hueVariance, hue+<span style="color: #000000">self.hueVariance), <span style="color: #008080">162 brightness: rand(50, 80<span style="color: #000000">), <span style="color: #008080">163 alpha: rand(40,100)/100, <span style="color: #008080">164 decay: rand(10, 50)/1000, <span style="color: #008080">165 wind: (rand(0, self.partWind) - (self.partWind/2))/25<span style="color: #000000">, <span style="color: #008080">166 <span style="color: #000000"> lineWidth: self.lineWidth <span style="color: #008080">167 <span style="color: #000000"> }; <span style="color: #008080">168 <span style="color: #000000"> self.particles.push(newParticle); <span style="color: #008080">169 <span style="color: #000000"> } <span style="color: #008080">170 <span style="color: #000000"> }; <span style="color: #008080">171 <span style="color: #008080">172 <span style="color: #008080">173 self.updateParticles = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">174 <span style="color: #0000ff">var i =<span style="color: #000000"> self.particles.length; <span style="color: #008080">175 <span style="color: #0000ff">while(i--<span style="color: #000000">){ <span style="color: #008080">176 <span style="color: #0000ff">var p =<span style="color: #000000"> self.particles[i]; <span style="color: #008080">177 <span style="color: #0000ff">var radians = p.angle * Math.PI / 180<span style="color: #000000">; <span style="color: #008080">178 <span style="color: #0000ff">var vx = Math.cos(radians) *<span style="color: #000000"> p.speed; <span style="color: #008080">179 <span style="color: #0000ff">var vy = Math.sin(radians) *<span style="color: #000000"> p.speed; <span style="color: #008080">180 p.speed *=<span style="color: #000000"> p.friction; <span style="color: #008080">181 <span style="color: #008080">182 p.coordLast[2].x = p.coordLast[1<span style="color: #000000">].x; <span style="color: #008080">183 p.coordLast[2].y = p.coordLast[1<span style="color: #000000">].y; <span style="color: #008080">184 p.coordLast[1].x = p.coordLast[0<span style="color: #000000">].x; <span style="color: #008080">185 p.coordLast[1].y = p.coordLast[0<span style="color: #000000">].y; <span style="color: #008080">186 p.coordLast[0].x =<span style="color: #000000"> p.x; <span style="color: #008080">187 p.coordLast[0].y =<span style="color: #000000"> p.y; <span style="color: #008080">188 <span style="color: #008080">189 p.x +=<span style="color: #000000"> vx; <span style="color: #008080">190 p.y +=<span style="color: #000000"> vy; <span style="color: #008080">191 p.y +=<span style="color: #000000"> p.gravity; <span style="color: #008080">192 <span style="color: #008080">193 p.angle +=<span style="color: #000000"> p.wind; <span style="color: #008080">194 p.alpha -=<span style="color: #000000"> p.decay; <span style="color: #008080">195 <span style="color: #008080">196 <span style="color: #0000ff">if(!hitTest(0,0,self.cw,self.ch,p.x-p.radius, p.y-p.radius, p.radius*2, p.radius*2) || p.alpha < .05<span style="color: #000000">){ <span style="color: #008080">197 self.particles.splice(i, 1<span style="color: #000000">); <span style="color: #008080">198 <span style="color: #000000"> } <span style="color: #008080">199 <span style="color: #000000"> }; <span style="color: #008080">200 <span style="color: #000000"> }; <span style="color: #008080">201 <span style="color: #008080">202 self.drawParticles = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">203 <span style="color: #0000ff">var i =<span style="color: #000000"> self.particles.length; <span style="color: #008080">204 <span style="color: #0000ff">while(i--<span style="color: #000000">){ <span style="color: #008080">205 <span style="color: #0000ff">var p =<span style="color: #000000"> self.particles[i]; <span style="color: #008080">206 <span style="color: #008080">207 <span style="color: #0000ff">var coordRand = (rand(1,3)-1<span style="color: #000000">); <span style="color: #008080">208 <span style="color: #000000"> self.ctx.beginPath(); <span style="color: #008080">209 <span style="color: #000000"> self.ctx.moveTo(Math.round(p.coordLast[coordRand].x), Math.round(p.coordLast[coordRand].y)); <span style="color: #008080">210 <span style="color: #000000"> self.ctx.lineTo(Math.round(p.x), Math.round(p.y)); <span style="color: #008080">211 <span style="color: #000000"> self.ctx.closePath(); <span style="color: #008080">212 self.ctx.strokeStyle = 'hsla('+p.hue+', 100%, '+p.brightness+'%, '+p.alpha+')'<span style="color: #000000">; <span style="color: #008080">213 <span style="color: #000000"> self.ctx.stroke(); <span style="color: #008080">214 <span style="color: #008080">215 <span style="color: #0000ff">if(self.flickerDensity > 0<span style="color: #000000">){ <span style="color: #008080">216 <span style="color: #0000ff">var inverseDensity = 50 -<span style="color: #000000"> self.flickerDensity; <span style="color: #008080">217 <span style="color: #0000ff">if(rand(0, inverseDensity) ===<span style="color: #000000"> inverseDensity){ <span style="color: #008080">218 <span style="color: #000000"> self.ctx.beginPath(); <span style="color: #008080">219 self.ctx.arc(Math.round(p.x), Math.round(p.y), rand(p.lineWidth,p.lineWidth+3)/2, 0, Math.PI*2, false) <span style="color: #008080">220 <span style="color: #000000"> self.ctx.closePath(); <span style="color: #008080">221 <span style="color: #0000ff">var randAlpha = rand(50,100)/100; <span style="color: #008080">222 self.ctx.fillStyle = 'hsla('+p.hue+', 100%, '+p.brightness+'%, '+randAlpha+')'<span style="color: #000000">; <span style="color: #008080">223 <span style="color: #000000"> self.ctx.fill(); <span style="color: #008080">224 <span style="color: #000000"> } <span style="color: #008080">225 <span style="color: #000000"> } <span style="color: #008080">226 <span style="color: #000000"> }; <span style="color: #008080">227 <span style="color: #000000"> }; <span style="color: #008080">228 <span style="color: #008080">229 <span style="color: #008080">230 self.createFireworks = <span style="color: #0000ff">function<span style="color: #000000">(startX, startY, targetX, targetY){ <span style="color: #008080">231 <span style="color: #0000ff">var newFirework =<span style="color: #000000"> { <span style="color: #008080">232 <span style="color: #000000"> x: startX, <span style="color: #008080">233 <span style="color: #000000"> y: startY, <span style="color: #008080">234 <span style="color: #000000"> startX: startX, <span style="color: #008080">235 <span style="color: #000000"> startY: startY, <span style="color: #008080">236 hitX: <span style="color: #0000ff">false<span style="color: #000000">, <span style="color: #008080">237 hitY: <span style="color: #0000ff">false<span style="color: #000000">, <span style="color: #008080">238 <span style="color: #000000"> coordLast: [ <span style="color: #008080">239 <span style="color: #000000"> {x: startX, y: startY}, <span style="color: #008080">240 <span style="color: #000000"> {x: startX, y: startY}, <span style="color: #008080">241 <span style="color: #000000"> {x: startX, y: startY} <span style="color: #008080">242 <span style="color: #000000"> ], <span style="color: #008080">243 <span style="color: #000000"> targetX: targetX, <span style="color: #008080">244 <span style="color: #000000"> targetY: targetY, <span style="color: #008080">245 <span style="color: #000000"> speed: self.fworkSpeed, <span style="color: #008080">246 angle: Math.atan2(targetY - startY, targetX -<span style="color: #000000"> startX), <span style="color: #008080">247 shockwaveAngle: Math.atan2(targetY - startY, targetX - startX)+(90*(Math.PI/180)), <span style="color: #008080">248 acceleration: self.fworkAccel/100, <span style="color: #008080">249 <span style="color: #000000"> hue: self.currentHue, <span style="color: #008080">250 brightness: rand(50, 80<span style="color: #000000">), <span style="color: #008080">251 alpha: rand(50,100)/100, <span style="color: #008080">252 <span style="color: #000000"> lineWidth: self.lineWidth <span style="color: #008080">253 <span style="color: #000000"> }; <span style="color: #008080">254 <span style="color: #000000"> self.fireworks.push(newFirework); <span style="color: #008080">255 <span style="color: #008080">256 <span style="color: #000000"> }; <span style="color: #008080">257 <span style="color: #008080">258 <span style="color: #008080">259 self.updateFireworks = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">260 <span style="color: #0000ff">var i =<span style="color: #000000"> self.fireworks.length; <span style="color: #008080">261 <span style="color: #008080">262 <span style="color: #0000ff">while(i--<span style="color: #000000">){ <span style="color: #008080">263 <span style="color: #0000ff">var f =<span style="color: #000000"> self.fireworks[i]; <span style="color: #008080">264 self.ctx.lineWidth =<span style="color: #000000"> f.lineWidth; <span style="color: #008080">265 <span style="color: #008080">266 vx = Math.cos(f.angle) *<span style="color: #000000"> f.speed, <span style="color: #008080">267 vy = Math.sin(f.angle) *<span style="color: #000000"> f.speed; <span style="color: #008080">268 f.speed *= 1 +<span style="color: #000000"> f.acceleration; <span style="color: #008080">269 f.coordLast[2].x = f.coordLast[1<span style="color: #000000">].x; <span style="color: #008080">270 f.coordLast[2].y = f.coordLast[1<span style="color: #000000">].y; <span style="color: #008080">271 f.coordLast[1].x = f.coordLast[0<span style="color: #000000">].x; <span style="color: #008080">272 f.coordLast[1].y = f.coordLast[0<span style="color: #000000">].y; <span style="color: #008080">273 f.coordLast[0].x =<span style="color: #000000"> f.x; <span style="color: #008080">274 f.coordLast[0].y =<span style="color: #000000"> f.y; <span style="color: #008080">275 <span style="color: #008080">276 <span style="color: #0000ff">if(f.startX >=<span style="color: #000000"> f.targetX){ <span style="color: #008080">277 <span style="color: #0000ff">if(f.x + vx <=<span style="color: #000000"> f.targetX){ <span style="color: #008080">278 f.x =<span style="color: #000000"> f.targetX; <span style="color: #008080">279 f.hitX = <span style="color: #0000ff">true<span style="color: #000000">; <span style="color: #008080">280 } <span style="color: #0000ff">else<span style="color: #000000"> { <span style="color: #008080">281 f.x +=<span style="color: #000000"> vx; <span style="color: #008080">282 <span style="color: #000000"> } <span style="color: #008080">283 } <span style="color: #0000ff">else<span style="color: #000000"> { <span style="color: #008080">284 <span style="color: #0000ff">if(f.x + vx >=<span style="color: #000000"> f.targetX){ <span style="color: #008080">285 f.x =<span style="color: #000000"> f.targetX; <span style="color: #008080">286 f.hitX = <span style="color: #0000ff">true<span style="color: #000000">; <span style="color: #008080">287 } <span style="color: #0000ff">else<span style="color: #000000"> { <span style="color: #008080">288 f.x +=<span style="color: #000000"> vx; <span style="color: #008080">289 <span style="color: #000000"> } <span style="color: #008080">290 <span style="color: #000000"> } <span style="color: #008080">291 <span style="color: #008080">292 <span style="color: #0000ff">if(f.startY >=<span style="color: #000000"> f.targetY){ <span style="color: #008080">293 <span style="color: #0000ff">if(f.y + vy <=<span style="color: #000000"> f.targetY){ <span style="color: #008080">294 f.y =<span style="color: #000000"> f.targetY; <span style="color: #008080">295 f.hitY = <span style="color: #0000ff">true<span style="color: #000000">; <span style="color: #008080">296 } <span style="color: #0000ff">else<span style="color: #000000"> { <span style="color: #008080">297 f.y +=<span style="color: #000000"> vy; <span style="color: #008080">298 <span style="color: #000000"> } <span style="color: #008080">299 } <span style="color: #0000ff">else<span style="color: #000000"> { <span style="color: #008080">300 <span style="color: #0000ff">if(f.y + vy >=<span style="color: #000000"> f.targetY){ <span style="color: #008080">301 f.y =<span style="color: #000000"> f.targetY; <span style="color: #008080">302 f.hitY = <span style="color: #0000ff">true<span style="color: #000000">; <span style="color: #008080">303 } <span style="color: #0000ff">else<span style="color: #000000"> { <span style="color: #008080">304 f.y +=<span style="color: #000000"> vy; <span style="color: #008080">305 <span style="color: #000000"> } <span style="color: #008080">306 <span style="color: #000000"> } <span style="color: #008080">307 <span style="color: #008080">308 <span style="color: #0000ff">if(f.hitX &&<span style="color: #000000"> f.hitY){ <span style="color: #008080">309 <span style="color: #000000"> self.createParticles(f.targetX, f.targetY, f.hue); <span style="color: #008080">310 self.fireworks.splice(i, 1<span style="color: #000000">); <span style="color: #008080">311 <span style="color: #008080">312 <span style="color: #000000"> } <span style="color: #008080">313 <span style="color: #000000"> }; <span style="color: #008080">314 <span style="color: #000000"> }; <span style="color: #008080">315 <span style="color: #008080">316 self.drawFireworks = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">317 <span style="color: #0000ff">var i =<span style="color: #000000"> self.fireworks.length; <span style="color: #008080">318 self.ctx.globalCompositeOperation = 'lighter'<span style="color: #000000">; <span style="color: #008080">319 <span style="color: #0000ff">while(i--<span style="color: #000000">){ <span style="color: #008080">320 <span style="color: #0000ff">var f =<span style="color: #000000"> self.fireworks[i]; <span style="color: #008080">321 self.ctx.lineWidth =<span style="color: #000000"> f.lineWidth; <span style="color: #008080">322 <span style="color: #008080">323 <span style="color: #0000ff">var coordRand = (rand(1,3)-1<span style="color: #000000">); <span style="color: #008080">324 <span style="color: #000000"> self.ctx.beginPath(); <span style="color: #008080">325 <span style="color: #000000"> self.ctx.moveTo(Math.round(f.coordLast[coordRand].x), Math.round(f.coordLast[coordRand].y)); <span style="color: #008080">326 <span style="color: #000000"> self.ctx.lineTo(Math.round(f.x), Math.round(f.y)); <span style="color: #008080">327 <span style="color: #000000"> self.ctx.closePath(); <span style="color: #008080">328 self.ctx.strokeStyle = 'hsla('+f.hue+', 100%, '+f.brightness+'%, '+f.alpha+')'<span style="color: #000000">; <span style="color: #008080">329 <span style="color: #000000"> self.ctx.stroke(); <span style="color: #008080">330 <span style="color: #008080">331 <span style="color: #0000ff">if<span style="color: #000000">(self.showTarget){ <span style="color: #008080">332 <span style="color: #000000"> self.ctx.save(); <span style="color: #008080">333 <span style="color: #000000"> self.ctx.beginPath(); <span style="color: #008080">334 self.ctx.arc(Math.round(f.targetX), Math.round(f.targetY), rand(1,8), 0, Math.PI*2, <span style="color: #0000ff">false<span style="color: #000000">) <span style="color: #008080">335 <span style="color: #000000"> self.ctx.closePath(); <span style="color: #008080">336 self.ctx.lineWidth = 1<span style="color: #000000">; <span style="color: #008080">337 <span style="color: #000000"> self.ctx.stroke(); <span style="color: #008080">338 <span style="color: #000000"> self.ctx.restore(); <span style="color: #008080">339 <span style="color: #000000"> } <span style="color: #008080">340 <span style="color: #008080">341 <span style="color: #0000ff">if<span style="color: #000000">(self.showShockwave){ <span style="color: #008080">342 <span style="color: #000000"> self.ctx.save(); <span style="color: #008080">343 <span style="color: #000000"> self.ctx.translate(Math.round(f.x), Math.round(f.y)); <span style="color: #008080">344 <span style="color: #000000"> self.ctx.rotate(f.shockwaveAngle); <span style="color: #008080">345 <span style="color: #000000"> self.ctx.beginPath(); <span style="color: #008080">346 self.ctx.arc(0, 0, 1*(f.speed/5), 0, Math.PI, true); <span style="color: #008080">347 self.ctx.strokeStyle = 'hsla('+f.hue+', 100%, '+f.brightness+'%, '+rand(25, 60)/100+')'; <span style="color: #008080">348 self.ctx.lineWidth =<span style="color: #000000"> f.lineWidth; <span style="color: #008080">349 <span style="color: #000000"> self.ctx.stroke(); <span style="color: #008080">350 <span style="color: #000000"> self.ctx.restore(); <span style="color: #008080">351 <span style="color: #000000"> } <span style="color: #008080">352 <span style="color: #000000"> }; <span style="color: #008080">353 <span style="color: #000000"> }; <span style="color: #008080">354 <span style="color: #008080">355 self.bindEvents = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">356 $(window).on('resize', <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">357 <span style="color: #000000"> clearTimeout(self.timeout); <span style="color: #008080">358 self.timeout = setTimeout(<span style="color: #0000ff">function<span style="color: #000000">() { <span style="color: #008080">359 self.canvas.width = self.cw =<span style="color: #000000"> $(window).innerWidth(); <span style="color: #008080">360 self.canvas.height = self.ch =<span style="color: #000000"> $(window).innerHeight(); <span style="color: #008080">361 self.ctx.lineCap = 'round'<span style="color: #000000">; <span style="color: #008080">362 self.ctx.lineJoin = 'round'<span style="color: #000000">; <span style="color: #008080">363 }, 100<span style="color: #000000">); <span style="color: #008080">364 <span style="color: #000000"> }); <span style="color: #008080">365 <span style="color: #008080">366 $(self.canvas).on('mousedown', <span style="color: #0000ff">function<span style="color: #000000">(e){ <span style="color: #008080">367 self.mx = e.pageX -<span style="color: #000000"> self.canvas.offsetLeft; <span style="color: #008080">368 self.my = e.pageY -<span style="color: #000000"> self.canvas.offsetTop; <span style="color: #008080">369 self.currentHue =<span style="color: #000000"> rand(self.hueMin, self.hueMax); <span style="color: #008080">370 self.createFireworks(self.cw/2, self.ch, self.mx, self.my); <span style="color: #008080">371 <span style="color: #008080">372 $(self.canvas).on('mousemove.fireworks', <span style="color: #0000ff">function<span style="color: #000000">(e){ <span style="color: #008080">373 self.mx = e.pageX -<span style="color: #000000"> self.canvas.offsetLeft; <span style="color: #008080">374 self.my = e.pageY -<span style="color: #000000"> self.canvas.offsetTop; <span style="color: #008080">375 self.currentHue =<span style="color: #000000"> rand(self.hueMin, self.hueMax); <span style="color: #008080">376 self.createFireworks(self.cw/2, self.ch, self.mx, self.my); <span style="color: #008080">377 <span style="color: #000000"> }); <span style="color: #008080">378 <span style="color: #000000"> }); <span style="color: #008080">379 <span style="color: #008080">380 $(self.canvas).on('mouseup', <span style="color: #0000ff">function<span style="color: #000000">(e){ <span style="color: #008080">381 $(self.canvas).off('mousemove.fireworks'<span style="color: #000000">); <span style="color: #008080">382 <span style="color: #000000"> }); <span style="color: #008080">383 <span style="color: #008080">384 <span style="color: #000000"> } <span style="color: #008080">385 <span style="color: #008080">386 self.clear = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">387 self.particles =<span style="color: #000000"> []; <span style="color: #008080">388 self.fireworks =<span style="color: #000000"> []; <span style="color: #008080">389 self.ctx.clearRect(0, 0<span style="color: #000000">, self.cw, self.ch); <span style="color: #008080">390 <span style="color: #000000"> }; <span style="color: #008080">391 <span style="color: #008080">392 <span style="color: #008080">393 self.canvasLoop = <span style="color: #0000ff">function<span style="color: #000000">(){ <span style="color: #008080">394 <span style="color: #000000"> requestAnimFrame(self.canvasLoop, self.canvas); <span style="color: #008080">395 self.ctx.globalCompositeOperation = 'destination-out'<span style="color: #000000">; <span style="color: #008080">396 self.ctx.fillStyle = 'rgba(0,0,0,'+self.clearAlpha/100+')'; <span style="color: #008080">397 self.ctx.fillRect(0,0<span style="color: #000000">,self.cw,self.ch); <span style="color: #008080">398 <span style="color: #000000"> self.updateFireworks(); <span style="color: #008080">399 <span style="color: #000000"> self.updateParticles(); <span style="color: #008080">400 <span style="color: #000000"> self.drawFireworks(); <span style="color: #008080">401 <span style="color: #000000"> self.drawParticles(); <span style="color: #008080">402 <span style="color: #008080">403 <span style="color: #000000"> }; <span style="color: #008080">404 <span style="color: #008080">405 <span style="color: #000000"> self.init(); <span style="color: #008080">406 <span style="color: #008080">407 <span style="color: #000000"> } <span style="color: #008080">408 <span style="color: #0000ff">var fworks = <span style="color: #0000ff">new<span style="color: #000000"> Fireworks(); <span style="color: #008080">409 <span style="color: #008080">410 <span style="color: #000000"> }); <span style="color: #008080">411 <span style="color: #008080">412 </script> <span style="color: #008080">413</span> <span style="color: #008080">414</span> <span style="color: #008080">415</span> </pre> </div> <p>廣大網友們!因為這是放假的時候老師給發的!所以我也看不太懂有些東西!實在是抱歉  有什麼不明白的,就留言告訴我!我去找我曾經的老師問問,雖然他已經退休好久了!!</p><p>以上是JQuery和html+css實作滑鼠點擊放煙火的詳細內容。更多資訊請關注PHP中文網其他相關文章!</p></div><div class="nphpQianMsg"><div class="clear"></div></div><div class="nphpQianSheng"><span>陳述:</span><div>本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn</div></div></div><div class="nphpSytBox"><span>上一篇:<a class="dBlack" title="javaScript事件綁使用方法" href="https://m.php.cn/zh-tw/faq/369618.html">javaScript事件綁使用方法</a></span><span>下一篇:<a class="dBlack" title="javaScript事件綁使用方法" href="https://m.php.cn/zh-tw/faq/369622.html">javaScript事件綁使用方法</a></span></div><div class="nphpSytBox2"><div class="nphpZbktTitle"><h2>相關文章</h2><em><a href="https://m.php.cn/zh-tw/article.html" class="bBlack"><i>看更多</i><b></b></a></em><div class="clear"></div></div><ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-6t+ed+2i-1n-4w" data-ad-client="ca-pub-5902227090019525" data-ad-slot="8966999616"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><ul class="nphpXgwzList"><li><b></b><a href="https://m.php.cn/zh-tw/faq/1609.html" title="深入淺析Bootstrap列表組元件" class="aBlack">深入淺析Bootstrap列表組元件</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/zh-tw/faq/1640.html" title="JavaScript函數柯里化詳解" class="aBlack">JavaScript函數柯里化詳解</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/zh-tw/faq/1949.html" title="JS密碼產生與強度偵測完整實例(附demo源碼下載)" class="aBlack">JS密碼產生與強度偵測完整實例(附demo源碼下載)</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/zh-tw/faq/2248.html" title="Angularjs整合微信UI(weui)" class="aBlack">Angularjs整合微信UI(weui)</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/zh-tw/faq/2351.html" title="JavaScript快速切換繁體中文和簡體中文的方法及網站支援簡繁體切換的絕招_javascript技巧" class="aBlack">JavaScript快速切換繁體中文和簡體中文的方法及網站支援簡繁體切換的絕招_javascript技巧</a><div class="clear"></div></li></ul></div></div><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="5027754603"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><footer><div class="footer"><div class="footertop"><img src="/static/imghwm/logo.png" alt=""><p>公益線上PHP培訓,幫助PHP學習者快速成長!</p></div><div class="footermid"><a href="https://m.php.cn/zh-tw/about/us.html">關於我們</a><a href="https://m.php.cn/zh-tw/about/disclaimer.html">免責聲明</a><a href="https://m.php.cn/zh-tw/update/article_0_1.html">Sitemap</a></div><div class="footerbottom"><p> © php.cn All rights reserved </p></div></div></footer><script>isLogin = 0;</script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script></div><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='/static/js/viewer.min.js?1'></script><script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script><script>jQuery.fn.wait = function (func, times, interval) { var _times = times || -1, //100次 _interval = interval || 20, //20毫秒每次 _self = this, _selector = this.selector, //选择器 _iIntervalID; //定时器id if( this.length ){ //如果已经获取到了,就直接执行函数 func && func.call(this); } else { _iIntervalID = setInterval(function() { if(!_times) { //是0就退出 clearInterval(_iIntervalID); } _times <= 0 || _times--; //如果是正数就 -- _self = $(_selector); //再次选择 if( _self.length ) { //判断是否取到 func && func.call(_self); clearInterval(_iIntervalID); } }, _interval); } return this; } $("table.syntaxhighlighter").wait(function() { $('table.syntaxhighlighter').append("<p class='cnblogs_code_footer'><span class='cnblogs_code_footer_icon'></span></p>"); }); $(document).on("click", ".cnblogs_code_footer",function(){ $(this).parents('table.syntaxhighlighter').css('display','inline-table');$(this).hide(); }); $('.nphpQianCont').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}}); </script></body><script> // 初始化菜单交互功能 document.addEventListener('DOMContentLoaded', function() { const menuGroupElements = document.querySelectorAll('.layui-menu-item-group'); menuGroupElements.forEach(menuItem => { menuItem.addEventListener('click', function(event) { // 防止子菜单点击触发父级事件 if (event.target.closest('.m_menusnames')) { return; } // 切换菜单状态 this.classList.toggle('layui-menu-item-down'); this.classList.toggle('layui-menu-item-up'); // 获取子菜单容器 const subMenuContainer = this.querySelector('.m_menusnames'); // 切换子菜单显示状态 if (subMenuContainer) { if (this.classList.contains('layui-menu-item-down')) { subMenuContainer.style.display = 'block'; this.querySelector('.layui-icon').classList.remove('layui-icon-down'); this.querySelector('.layui-icon').classList.add('layui-icon-up'); } else { subMenuContainer.style.display = 'none'; this.querySelector('.layui-icon').classList.remove('layui-icon-up'); this.querySelector('.layui-icon').classList.add('layui-icon-down'); } } }); }); }); </script><!-- Matomo --><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://tongji.php.cn/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '9']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!-- End Matomo Code --></html>