JavaScripts -> Animation -> Schütteln (MouseOver)

Wenn der User mit der Maus über den Text, das Bild etc. fährt, fängt dieses an zu wackeln.

Kompatibilität getestet:
Beispiel Anzeigen >>

Script-Code

<script type="text/javascript">
<!--
//MouseOver-Shaker (c) 2003 Triple-M / http://www.htmlarsenal.de

//Benutzung: ein Script mit dem Inhalt shakemo("Text, Bilder etc.") an der Stelle, wo der Effekt hinsoll
//Usage: a script with the content shakemo("text, images etc") at the position where the effect shall be placed

var speed=20; // Geschwindigkeit / speed
var max=3; // Schüttel-Stärke / shake strength

//Ab hier bitte nichts mehr veraendern / Please do not change anything from here on

var interv=new Array();

function shakemo(content) {
  id="sl"+Math.floor(Math.random()*10000);
  document.write('<span style="position:relative; left:0px; top:0px" id="'+id+'" onMouseOver="shake(\''+id+'\')" onMouseOut="stopshaking(\''+id+'\')">'+content+'</span>');
}

function shake(id) {
  document.getElementById(id).style.left=(0-max+Math.floor(Math.random()*(2*max+1)))+"px";
  document.getElementById(id).style.top=(0-max+Math.floor(Math.random()*(2*max+1)))+"px";
  interv[id]=window.setTimeout("shake('"+id+"')",speed);
}

function stopshaking(id) {
  document.getElementById(id).style.left="0px";
  document.getElementById(id).style.top="0px";
  window.clearTimeout(interv[id]);
}

//-->
</script>