- Login blog anda klik tata letak tambah gadget HTML/javascript masukkan code dibawah ini dan paste didalamnya.
<script type='text/javascript'>
//<![CDATA[
// Ojos que siguen al cursor
// Script original de Oopstudios.com
// Adaptado por ciudadblogger.com
EYES = {};
EYES.stack = [];
//
EYES.follow = function (eye) {
var el1 = document.getElementById (eye);
var el2 = el1.getElementsByTagName ("IMG");
el2 = el2[0];
el2.centre = (el1.offsetWidth - el2.offsetWidth) / 2;
el2.style.margin = el2.centre + "px 0 0 " + el2.centre + "px";
el1.maxDist = 6 * el1.offsetWidth;
EYES.stack.push ([el1, el2]);
};
EYES.mousemove = function (e) {
if (!EYES.stack.length) {
return;
}
//
var mouseX = mouseY = 0;
if (!e) var e = window.event;
if (e.pageX || e.pageY) {
mouseX = e.pageX;
mouseY = e.pageY;
} else if (e.clientX || e.clientY) {
mouseX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
mouseY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
//
for (var e=0, l=EYES.stack.length; e<l; e++) {
var el = EYES.stack[e];
var elX = elY = 0;
if (el[0].offsetParent) {
obj = el[0];
do {
elX += obj.offsetLeft;
elY += obj.offsetTop;
} while (obj = obj.offsetParent);
}
el[0].centreX = elX + Math.round (el[0].offsetWidth / 2);
el[0].centreY = elY + Math.round (el[0].offsetHeight / 2);
var difX = mouseX - el[0].centreX;
var difY = mouseY - el[0].centreY;
var dTan = Math.atan2 (difX, difY);
var dist = Math.sqrt ((difX * difX) + (difY * difY));
dist = Math.sin ((dist > el[0].maxDist ? 1 : dist / el[0].maxDist));
var newX = el[1].centre + Math.round (Math.sin (dTan) * el[1].centre * dist);
var newY = el[1].centre + Math.round (Math.cos (dTan) * el[1].centre * dist);
el[1].style.margin = newY + "px 0 0 " + newX + "px";
}
};
if (window.attachEvent) document.attachEvent ("onmousemove", EYES.mousemove);
else document.addEventListener ("mousemove", EYES.mousemove, false);
//]]>
</script>
<div style="position:relative; height:150px; margin-bottom:30px;">
<div id="Ojo1" style="width: 170px; height: 140px;
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3XF_0vhVFWCR7b6o8pRuHWgpjhTMM4HtLfLpDtR1Ei6qT95ttUxJc6vIb6w6ubDTf3cFJuTbj3SO4Oa1i6K2Bjk49FbCBxTdLwZwPXP9fbinn7U0f7cukjDAVrZlTWxOPgII2SrBzu6Q/s170/ojo_1.png) center center no-repeat; position: absolute; left: 307px; top: 20px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJJtn8bECZyqOr5FQXtx00-GeZZD-28eF47KPZJOxhTegp_ZSJ-XWFgxkjVL2bSEKJoOjNY_YSlBq-ESEUjvCLRnyk-b9p80XVhbZIxJWeZiL1zr7NpNaX0Vf5Om_Ai1gMg_oYm2EvOkQ/s30/pupila.png" width="23" height="23" /></div>
<div id="Ojo2" style="width: 170px; height: 140px; background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFwmGnxeHeuWFZKCyacX-xLNN1uouLsilEft53Pf1sVMhhH2JyZKun7xAUg7GlLQsC2i3mrZ9vAmLozMWbjpCphNlZ_4ZV2fN3j8SYrLLeOkYq7m_cDCtm9BY0IaTzQ44-HQYrm8mxd70/s170/ojo_2.png) center center no-repeat; position:absolute;
left: 485px; top: 20px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJJtn8bECZyqOr5FQXtx00-GeZZD-28eF47KPZJOxhTegp_ZSJ-XWFgxkjVL2bSEKJoOjNY_YSlBq-ESEUjvCLRnyk-b9p80XVhbZIxJWeZiL1zr7NpNaX0Vf5Om_Ai1gMg_oYm2EvOkQ/s30/pupila.png" width="23" height="23" /></div>
</div>
<script type="text/javascript">
EYES.follow ('Ojo1');
EYES.follow ('Ojo2');
</script>
Jika anda ingin gambar yang lain
<div
style="position:relative; height:145px; margin-bottom:30px;">
<div id="Ojo1" style="width: 132px; height: 143px; background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiPuvyFYQNjqmfeQWXfObvIQ3exIFRwkpTINNehibJV7NSiEDh8LDQc8DLUjtwSfJym0Hru-rYPpCFktH_SH4aiE4Ay1E43T6JzsHV2u4MY0VWD0-rB12aWNZfTAUqBnuZk8OZd69nWaI/s143/ojo1.png) center center no-repeat; position:absolute; left: 377px; top: 20px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj39pxJFW398MillDb0CEZdb4Q-wvEz0NiI_y48SWAB5F31x2QniWHxgfe0pBIRsDA6NoyLf2erjoXwXYuj-FXpZYqZD-CjWu_8glHig7gc1qVkgbZlq9fdLgd57SQns1xf0fLEgotgwu4/s34/pupila.png" width="30" height="30" /></div>
<div id="Ojo2" style="width: 132px; height: 143px; background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-qlFeR0Ei7JAUFGgd5FJG4W8XyRq-WBoRUgjnj-3kCZxT0CR6ZbhvOIO6DbXb3fjO4NQ-7VawuHOnkv06g_RPiybnhON1VXjGSpAETVueDzKLbHkSvrdplofUjyxM_6YmUxeG-3A_g_Y/s143/ojo2.png) center center no-repeat; position:absolute; left: 485px; top: 20px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj39pxJFW398MillDb0CEZdb4Q-wvEz0NiI_y48SWAB5F31x2QniWHxgfe0pBIRsDA6NoyLf2erjoXwXYuj-FXpZYqZD-CjWu_8glHig7gc1qVkgbZlq9fdLgd57SQns1xf0fLEgotgwu4/s34/pupila.png" width="30" height="30" /></div>
</div>
<div id="Ojo1" style="width: 132px; height: 143px; background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiPuvyFYQNjqmfeQWXfObvIQ3exIFRwkpTINNehibJV7NSiEDh8LDQc8DLUjtwSfJym0Hru-rYPpCFktH_SH4aiE4Ay1E43T6JzsHV2u4MY0VWD0-rB12aWNZfTAUqBnuZk8OZd69nWaI/s143/ojo1.png) center center no-repeat; position:absolute; left: 377px; top: 20px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj39pxJFW398MillDb0CEZdb4Q-wvEz0NiI_y48SWAB5F31x2QniWHxgfe0pBIRsDA6NoyLf2erjoXwXYuj-FXpZYqZD-CjWu_8glHig7gc1qVkgbZlq9fdLgd57SQns1xf0fLEgotgwu4/s34/pupila.png" width="30" height="30" /></div>
<div id="Ojo2" style="width: 132px; height: 143px; background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-qlFeR0Ei7JAUFGgd5FJG4W8XyRq-WBoRUgjnj-3kCZxT0CR6ZbhvOIO6DbXb3fjO4NQ-7VawuHOnkv06g_RPiybnhON1VXjGSpAETVueDzKLbHkSvrdplofUjyxM_6YmUxeG-3A_g_Y/s143/ojo2.png) center center no-repeat; position:absolute; left: 485px; top: 20px;">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj39pxJFW398MillDb0CEZdb4Q-wvEz0NiI_y48SWAB5F31x2QniWHxgfe0pBIRsDA6NoyLf2erjoXwXYuj-FXpZYqZD-CjWu_8glHig7gc1qVkgbZlq9fdLgd57SQns1xf0fLEgotgwu4/s34/pupila.png" width="30" height="30" /></div>
</div>
Dan Juga ini
<div
style="position:relative; height:145px; margin-bottom:30px;">
<div id="Ojo1"
style="width: 127px; height: 135px; background:
url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdO-y5fbDcuJqm-QNOxqQ-z8S6_4dDkuxDiAh-fs_FsSvDir8zdLUOij_JagxiJvOLCL78_GWueVcL0qgtA-AM9iRNOCSXED5fBp5PF0cm_unrBuf4KRf1wlcFmAEUBmtLDduOmgPN6vQ/s135/ojo1.png)
center center no-repeat; position:absolute; left: 377px; top: 20px;">
<img
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHpr6qW_6cPmsnzM-XynUbYwePcw8lrv_xqdeZtQjir_M-jK3-HS3F6PA_fCOOdsVtH3yq0KyguBjAWjgjguJCGJxDWo4dUWhQAXXnlYt1ljPMM38wqN6jWrzyumc97xRHqCLKqcwTusM/s34/pupila.png"
width="30" height="30" /></div>
<div id="Ojo2"
style="width: 127px; height: 135px; background:
url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo9a8LHFKi1XY4s9_XKyox5nGDwGoFii40VTiHbi_koBG1BdOoe1WEaTp0LBmU0TYgEHUAQ5Nte4OqWaMjYEM-UUR1pOVPxKuPRiKSSTsZem-z-9IZCneLwbNUzj3SMxJffFmjPNqoQpw/s135/ojo2.png)
center center no-repeat; position:absolute; left: 515px; top: 20px;">
<img
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHpr6qW_6cPmsnzM-XynUbYwePcw8lrv_xqdeZtQjir_M-jK3-HS3F6PA_fCOOdsVtH3yq0KyguBjAWjgjguJCGJxDWo4dUWhQAXXnlYt1ljPMM38wqN6jWrzyumc97xRHqCLKqcwTusM/s34/pupila.png"
width="30" height="30" /></div>
</div>
Semoga bermanfaat........
0 comments: on "Widget Mata Mengikuti Cursor"
Post a Comment