跟随鼠标旋转滚动的眼睛,网页上很经典的眼睛转动特效,鼠标移动自动旋转,兼容当前所有浏览器。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>随鼠标转动的眼睛js特效_武鸣人</title> <style type="text/css"> img{border:0px} #logo_wuming{background:url(/img/20240606_www_wuming_ren_1.gif); width:160px; height:60px; overflow:hidden;} </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div id="logo_wuming"> <div id="wuming_ren_logoeye"><a href="https://www.wuming.ren" title="武鸣人首页"><img src="/img/20240606_www_wuming_ren_2.gif" alt="武鸣人首页" /></a> </div> </div> <script type="text/javascript"> function m(a, b) {//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) return a.position = b } function o(a, b) {//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) return a.left = b } function ca(a, b) { return a.zIndex = b } var p = "length", r = "style", s = "body", x, y; function U(a) {//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) return document.createElement(a) } var Y, mb, nb, ob, pb, Z, $; var qb =73,rb=30,sb=69,tb=30,ub=91,vb=30,wb=74,xb=30,yb=83,zb=30,Ab=8,Bb=6,Cb=1,Db=100; var Eb; var Fb = "/img/20240606_www_wuming_ren_2.gif"; function Gb(a) {//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var b = 0, c = 0; if (a.pageX || a.pageY) { b = a.pageX; c = a.pageY } else if (a.clientX || a.clientY) { b = a.clientX + document[s].scrollLeft; c = a.clientY + document[s].scrollTop } return [b, c] } function Ib(a) { Jb(); a = a || document.parentWindow.event; var b = Gb(a), c = b[0], d = b[1]; Kb(c, d, Z, sb, tb); Kb(c, d, $, ub, vb) }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function Kb(a, b, c, d, g) { var e = a - d - mb, f = (b - g - nb) * (Ab / Bb), j = Math.sqrt(Math.pow(e, 2) + Math.pow(f, 2)), h, l; if (j == 0) { h = d; l = g } else { var B = Math.sqrt(Math.pow(j, 2) + Math.pow(Db, 2)), E = Ab * j / B; h = E * e / j + d + mb; l = E * f / j / (Ab / Bb) + g + nb } h -= Cb; l -= Cb; o(c[r], parseInt(h, 10) + "px"); c[r].top = parseInt(l, 10) + "px" }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function EYES_init() { var a = Mb("wuming_ren_logoeye"), b = Nb(a, "a"); Eb = Nb(a, "img"); if ( - 1 == Eb.src.indexOf(Fb)) { return } Y = U("img"); Z = U("img"); $ = U("img"); Y.border = (Z.border = ($.border = 0)); Y.src = "/img/20240606_www_wuming_ren_4.gif"; Z.src = ($.src = "/img/20240606_www_wuming_ren_3.gif"); Jb(); m(Y[r], m(Z[r], m($[r], "absolute"))); ca(Y[r], 90); ca(Z[r], ca($[r], 100)); b.appendChild(Y); b.appendChild(Z); b.appendChild($); document.onmousemove = Ib; // T(window, "pageshow", Jb); // T(window, "resize", Jb) }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function Jb() { var a = Ob(Eb); mb = a.x; nb = a.y; ob = Eb.width; pb = Eb[p]; var b = "px"; o(Y[r], mb + qb + b); Y[r].top = nb + rb + b; o(Z[r], a.x + wb + b); Z[r].top = a.y + xb + b; o($[r], a.x + yb + b); $[r].top = a.y + zb + b } function Ob(a) { var b = a.offsetLeft, c = a.offsetTop; if (a.offsetParent != null) { var d = Ob(a.offsetParent); b += d.x; c += d.y; } return{x:b,y:c} } function T(a, b, c) { var d = "on" + b; if (a.addEventListener) { a.addEventListener(b, c, false) } else if (a.attachEvent) { a.attachEvent(d, c) } else { var g = a[d]; a[d] = function() { var e = g.apply(this, arguments), f = c.apply(this, arguments); return e == undefined ? f : (f == undefined ? e : f && e) } } }; function Mb(a) { return document.getElementById(a) }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function Nb(a, b) { return a.getElementsByTagName(b)[0] }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) EYES_init(); </script> </body> </html>
本文来自武鸣人网站,转载请注明出处