This article mainly introduces how to generate bubbles by swiping the mouse over JavaScript, involving the operation skills related to mouse events and page styles, for more information about how to generate a bubble by swiping the mouse over JavaScript, see the example in this article. Share it with you for your reference. The specific implementation method is as follows:
Generate bubbles around the mouse on the webpageSCRIPT object = new Array () var xm, ymfunction CObj (N, obj) {aqua. insertAdjacentHTML ("AfterBegin", "") this. img = aqua. firstChild. stylemr = Math. random () this. v = 6 * mr + 4this. s =. 5 * mrthis. p =. 1 + mrthis. w = 0this. k = 0this. x = xmthis. y = Nthis. chteuMeulEu = function ChteuMeulEu () {with (this) {with (img) {left = (x + = 0.5 * v * Math. sin (k + = s)-w * 0.5top = y-= vwidth = Math. min (w + = p, 100)} if (y <-w) {w = 8y = ymx = xm }}} function gradient (R, G, B, m) {for (I = 0; I <25; I ++) {c = 255-10 * iC = "\" RGB ("+ Math. round (c * R/255) + "," + Math. round (c * G/255) + "," + Math. round (c x B/255) + ") \" "code =" "document. body. insertAdjacentHTML ("beforeEnd", code)} function zyva () {xm = document. body. offsetWidth * 0.5ym = document. body. offsetHeightdocument. onmousemove = function () {xm = window. event. clientXym = window. event. clientY} for (I = 0; I <60; I ++) object [I] = new CObj (I, B) setInterval ("for (I in object) object [I]. chteuMeulEu () ", 16) gradient (,)} SCRIPT
I hope this article will help you design javascript programs.