Hier ist ein Beispiel: Link.
[Beschreibung]
Beim Klicken auf einen Link werden die umliegenden Inhalte in ein schwarzes Loch gezogen und die entsprechende Seite aufgerufen.
[Kompatibilität]
[Code]
var href; function showBlackHole(){ var obj = document.getElementById("hole").style; obj.position = 'absolute'; obj.top = Math.round((document.body.clientHeight - document.imgHole.height)/2); obj.left = Math.round((document.body.clientWidth - document.imgHole.width)/2); obj.visibility = 'visible'; }
function fitToScreen(){ var obj = document.getElementById("doc").style; obj.position = 'absolute'; obj.top = 0; obj.height = document.body.clientHeight; obj.width = document.body.clientWidth; obj.overflow = 'hidden'; }
function initImplode(){ if ((!document.all) || (!document.getElementById)){ document.location.href = href; return; } showBlackHole(); fitToScreen(); var docdiv = document.getElementById("doc").style; x1 = parseInt(docdiv.left); y1 = parseInt(docdiv.top); x2 = x1 + docdiv.width; y2 = y1; x3 = x2; y3 = y1 + docdiv.height; x4 = x1; y4 = y3; imgdiv = document.getElementById("hole").style; a1 = parseInt(imgdiv.left); b1 = parseInt(imgdiv.top); a2 = a1 + document.imgHole.width; b2 = b1; a3 = a2; b3 = b2 + document.imgHole.height; a4 = a1; b4 = b3; oldWidth = parseInt(docdiv.width); oldHeight = parseInt(docdiv.height); blackTimer = null; i = x1 + 1; implode(); }
function implode(){ var obj = document.getElementById("doc").style; if ((parseInt(obj.left) >= a1+Math.ceil(parseInt(document.getElementById('imgHole').height) / 2)) || (parseInt(obj.top) >= b1+Math.ceil(parseInt(document.getElementById('imgHole').width) / 2))){ obj.top = b1 + Math.ceil(parseInt(document.getElementById('imgHole').width) / 2); obj.left = a1 + Math.ceil(parseInt(document.getElementById('imgHole').height) / 2); obj.width = 0; obj.height = 0; stop(); return; } obj.left = i; try{ obj.width = oldWidth - 2*i; } catch(e){} var j = Math.round(((y1-b1)/(x1-a1))*i); obj.top = j; try{ obj.height = oldHeight - 2*j; } catch(e){} i+=10; blackTimer = window.setTimeout("implode()", 1); }
function stop(){ window.clearTimeout(blackTimer); document.location.href = href; }
function hyperlink(ref){ href = ref; initImplode(); } --> </script>
Vjekoslav Begovic
Kopieren Sie bitte den Code