// JavaScript Document /////////////////////////////////////////// Scroller functions //////////////////////////////// function check_sroll() { var div = document.getElementById("inhalt"); if(div != null) { var height = div.offsetHeight; var width = div.offsetWidth; var position = parseInt(width / 2); if(height > 244) { document.getElementById("scroll_up").style.visibility = "visible"; document.getElementById("scroll_down").style.visibility = "visible"; document.getElementById("scroll_up").style.marginLeft = position+"px"; document.getElementById("scroll_down").style.marginLeft = position+"px"; } div.style.height = "244px"; } } /** This is high-level function; REPLACE IT WITH YOUR CODE. * It must react to delta being more/less than zero. */ function check_slidersroll(anzahl) { for(x=1;x<=anzahl;x++) { var div = document.getElementById("inhalt_"+x); if(div != null) { var height = div.offsetHeight; var width = div.offsetWidth; var position = parseInt(width / 2); /*alert(height);*/ if(height > 244) { document.getElementById("scroll_up_"+x).style.visibility = "visible"; document.getElementById("scroll_down_"+x).style.visibility = "visible"; document.getElementById("scroll_up_"+x).style.marginLeft = position+"px"; document.getElementById("scroll_down_"+x).style.marginLeft = position+"px"; } div.style.height = "212px"; } } } function handle(delta) { if (delta < 0) { scroller2("dn"); } else { scroller2("up"); } } var hzuxbux = 1; function scroller2(direction) { if(direction == "dn") { document.getElementById("inhalt").scrollTop+=30; } else { document.getElementById("inhalt").scrollTop-=30; } if(hzuxbux < 3) { setTimeout("scroller2()", 10); hzuxbux++; } } function wheel(event){ var delta = 0; if (!event) event = window.event; if (event.wheelDelta) { delta = event.wheelDelta/120; if (window.opera) delta = -delta; } else if (event.detail) { delta = -event.detail/3; } if (delta) handle(delta); if (event.preventDefault) event.preventDefault(); event.returnValue = false; } /* Initialization code. */ if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false); window.onmousewheel = document.onmousewheel = wheel; /* scroll event content*/ var d=document; var mode = "still"; var speed = 20; // in Millisekunden var step_size = 4; // Schrittweite function scroll( aNum) { // alert ("Ref= "+ref); switch(aNum) { case 1: // scroll up mode = "scroll_up"; break; case -1: // scroll down mode = "scroll_down"; break; case 0: // stop scrolling mode = "still"; break; } do_scroll(); } function do_scroll() { var ref = d.getElementById("inhalt"); switch (mode) { case "still": // nothing break; case "scroll_up": ref.scrollTop-=step_size; window.setTimeout("do_scroll()", speed); break; case "scroll_down": ref.scrollTop+=step_size; window.setTimeout("do_scroll()", speed); break; } } function changeimg(img_name) { document.getElementById("rezeptimg").src = "images/small/"+img_name; }