You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.2 KiB
29 lines
1.2 KiB
|
|
function simpleMachicharaUpdater(element) {
|
|
return function() {
|
|
simpleMachicharaUpdate(element);
|
|
}
|
|
}
|
|
|
|
function simpleMachicharaUpdate(element) {
|
|
clearTimeout(element.interval);
|
|
element.style.top = Math.floor(Math.random()*90) + "%";
|
|
element.style.left = Math.floor(Math.random()*90) + "%";
|
|
element.interval = window.setTimeout(simpleMachicharaUpdater(element), 5000+Math.floor(Math.random()*25000));
|
|
}
|
|
|
|
function simpleMachichara(imageUrl) {
|
|
var machicharaSimpleElement = document.createElement("div");
|
|
machicharaSimpleElement.zIndex = 1000;
|
|
machicharaSimpleElement.style.position = isIe ? "absolute" : "fixed";
|
|
machicharaSimpleElement.style.top = "50%";
|
|
machicharaSimpleElement.style.left = "50%";
|
|
machicharaSimpleElement.style.zIndex = 11;
|
|
document.body.appendChild(machicharaSimpleElement);
|
|
var machicharaSimpleImageElement = document.createElement("img");
|
|
machicharaSimpleImageElement.src = imageUrl;
|
|
machicharaSimpleImageElement.style.border = "none";
|
|
machicharaSimpleElement.appendChild(machicharaSimpleImageElement);
|
|
machicharaSimpleElement.onmouseover = simpleMachicharaUpdater(machicharaSimpleElement);
|
|
simpleMachicharaUpdate(machicharaSimpleElement);
|
|
} |