Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /*
  2.  *  Copyright (c) 2012 [iPs]TeaM
  3.  *  Bruno da Silva (email@brunodasilva.com)
  4.  *  Simples sistema para simular o efeito deslizar texto sobre imagem
  5.  
  6.  * www.brunodasilva.com
  7.  * www.ips-team.forumeiros.com
  8. */
  9.  
  10. <div><img onmouseout="fritasDesmover();" onmouseover="fritasMover();"  src="http://cybercook2.terra.com.br/img/receita/batatas-fritas-f8-3028.jpg" /></div>
  11. <div id="textoBatatas" style=" position:absolute; background-color:gray; top:343px; display:none; ">Eu gosto de batatas-fritas, é crocante e deliciosa, ótimo aperitivo pra tarde</div>
  12.  
  13.  
  14.  
  15. <script>
  16.  
  17.  
  18. // Posição 322 é onde termina de mover, lembre-se !!
  19. // 343 é a posição de onde a div começará a se mover
  20. // Mude os números no script :)
  21.  
  22. /////////////
  23.  
  24. var i = 0;
  25. var timer = 0;
  26. var obj = document.getElementById('textoBatatas');
  27.  
  28. //////////////
  29.  
  30. function fritasMover() {
  31.     if(i == 0) {
  32.         obj.style.display = "block";   
  33.         timer = setInterval("moverFritasCima()", 10);
  34.     }
  35. }
  36.  
  37. function fritasDesmover() {
  38.     if(i == (343 - 322)) {
  39.         obj.style.display = "block";   
  40.         timer = setInterval("moverFritasBaixo()", 10);
  41.     }
  42. }
  43.  
  44. ////////////
  45.  
  46. function moverFritasBaixo() {  
  47.     i --;
  48.     if(i == 0) {
  49.         obj.style.display = "none";
  50.         clearInterval(timer);
  51.     }
  52.     obj.style.top = 343- i + "px"  
  53. }
  54.  
  55. function moverFritasCima() {   
  56.     i ++;
  57.     if(i == (343 - 322)) clearInterval(timer);
  58.     obj.style.top = 343- i + "px"  
  59. }
  60.  
  61.  
  62. </script>