Phiên bản đầy đủ: jsB@nk » Vui nhộn » Đuổi bắt ảnh
URL: https://www.javascriptbank.com/catch-me-if-you-really-can.html
Hiệu ứng làm cho ảnh luôn chuyển động cùng với con trỏ chuột nhưng không bao giờ chúng có thể đụng nhau.
Phiên bản đầy đủ: jsB@nk » Vui nhộn » Đuổi bắt ảnh
URL: https://www.javascriptbank.com/catch-me-if-you-really-can.html
<SCRIPT>// Catch me if you really canvar x=0var y=0var xpos=0var ypos=0var xcentervar ycentervar windowheightvar windowheightfunction cursortracker(e){x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientXy = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY}function inite() {if (document.layers) {windowheight=window.innerHeightwindowwidth=window.innerWidthdocument.captureEvents(Event.MOUSEMOVE);document.onmousemove=cursortracker;}if (document.all) {windowheight=document.body.clientHeight windowwidth=document.body.clientWidthdocument.onmousemove=cursortracker;}xcenter=Math.round(windowwidth/2)ycenter=Math.round(windowheight/2)changeposition()}function changeposition() {if (x>=(xcenter-60) && x<=xcenter) {xpos=0}else if (x<=(xcenter+60) && x>=xcenter) {xpos=windowwidth-60}else {xpos=-1*(x-xcenter)+xcenter}if (y>=(ycenter-50) && y<=ycenter) {ypos=ycenter+50}else if (y<=(ycenter+50) && y>=ycenter) {ypos=ycenter-50}else {ypos=-1*(y-ycenter)+ycenter}if (document.all) { document.all.catchmeimg.style.posLeft=xposdocument.all.catchmeimg.style.posTop=ypos}if (document.layers) { document.catchmeimg.left=xposdocument.catchmeimg.top=ypos}var timer=setTimeout("changeposition()",50)}</SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<BODY onload=inite()><DIV id=catchmeimg style="LEFT: -200px; POSITION: absolute; TOP: -1000px"> <IMG src="../image/logojs.gif" width="30" height="77"> </DIV></BODY><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->