quinta-feira, 7 de janeiro de 2016

Como colocar imagem seguindo o cursor do mouse(BLOGGER)

Em layout,clique em adicionar gadget, depois clique em

HTML/JavaScriptAdicionar

Cole o código abaixo na segunda parte. Salvar. E por fim salvar organização.


<script language="JavaScript1.2">
<!--

var trailLength = 7
var path = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmKPIEMdd-MAXObZRXR06zgck-bOYRF-5TFnFVWssFXJfnWnnSMsWRIteg2s7aaIkHCQAahC4J_lMPyinoeT62V-_1RPTXf6GH50SH5hG-eK8MlPaDIRLlcyJAVJsTjhwKjRU3LYNWV4E/s1600/cinnamoroll_11.gif"

var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
var i,d = 0

function initTrail() {
images = new Array()
for (i = 0; i < parseInt(trailLength); i++) {
images[i] = new Image()
images[i].src = path
}
storage = new Array()
for (i = 0; i < images.length*3; i++) {
storage[i] = 0
}
for (i = 0; i < images.length; i++) {
document.write('<div id="obj' + i + '" style="position: absolute; z-Index: 100; height: 0; width: 0"><img src="' + images[i].src + '"></div>')
}
trail()
}
function trail() {
for (i = 0; i < images.length; i++) {
document.getElementById("obj" + i).style.top = storage[d]+'px'
document.getElementById("obj" + i).style.left = + storage[d+1]+'px'
d = d+2
}
for (i = storage.length; i >= 2; i--) {
storage[i] = storage[i-2]
}
d = 0
var timer = setTimeout("trail()",20)
}
function processEvent(e) {
if (window.event) {
storage[0] = window.event.y+standardbody.scrollTop+10
storage[1] = window.event.x+standardbody.scrollLeft+10
} else {
storage[0] = e.pageY+12
storage[1] = e.pageX+12
}
}

initTrail()
document.onmousemove = processEvent

//-->
</script>



Ou se quiser outra imagem:

<script language="JavaScript1.2">
<!--

var trailLength = 7
var path = "COLE AQUI A URL DA IMAGEM"

var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
var i,d = 0

function initTrail() {
images = new Array()
for (i = 0; i < parseInt(trailLength); i++) {
images[i] = new Image()
images[i].src = path
}
storage = new Array()
for (i = 0; i < images.length*3; i++) {
storage[i] = 0
}
for (i = 0; i < images.length; i++) {
document.write('<div id="obj' + i + '" style="position: absolute; z-Index: 100; height: 0; width: 0"><img src="' + images[i].src + '"></div>')
}
trail()
}
function trail() {
for (i = 0; i < images.length; i++) {
document.getElementById("obj" + i).style.top = storage[d]+'px'
document.getElementById("obj" + i).style.left = + storage[d+1]+'px'
d = d+2
}
for (i = storage.length; i >= 2; i--) {
storage[i] = storage[i-2]
}
d = 0
var timer = setTimeout("trail()",20)
}
function processEvent(e) {
if (window.event) {
storage[0] = window.event.y+standardbody.scrollTop+10
storage[1] = window.event.x+standardbody.scrollLeft+10
} else {
storage[0] = e.pageY+12
storage[1] = e.pageX+12
}
}

initTrail()
document.onmousemove = processEvent

//-->
</script>

Nenhum comentário:

Postar um comentário