Einzelnen Beitrag anzeigen
  #11 (permalink)  
Alt 19-05-2009, 15:25
sir_holmes
 Registrierter Benutzer
Links : Onlinestatus : sir_holmes ist offline
Registriert seit: Apr 2001
Beiträge: 64
sir_holmes ist zur Zeit noch ein unbeschriebenes Blatt
Exclamation

Also ich habe jetzt versucht den Event-Handler einzubauen. Hat soweit auch geklappt... Scrollen per Mausrad klappt. Aber dafür kann man nicht mehr über die Pfeile scrollen!?!? An dem Code habe ich aber nichts verändert:


function TextScroll(scrollname, div_name, up_name, down_name)
{
this.div_name = div_name;
this.name = scrollname;
this.scrollCursor = 0;
this.speed = 5;
this.timeoutID = 0;
this.div_obj = null;
this.up_name = up_name;
this.dn_name = down_name;

{
if (document.getElementById) {
div_obj = document.getElementById(this.div_name);
if (div_obj) {
this.div_obj = div_obj;
this.div_obj.style.overflow = 'hidden';
}
div_up_obj = document.getElementById(this.up_name);
div_dn_obj = document.getElementById(this.dn_name);
if (div_up_obj && div_dn_obj) {
div_up_obj.onmousedown = function() { eval(scrollname + ".scrollUp();") };
div_up_obj.onmouseup = function() { eval(scrollname + ".stopScroll();") };
div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
div_dn_obj.onmousedown = function() { eval(scrollname + ".scrollDown();") };
div_dn_obj.onmouseup = function() { eval(scrollname + ".stopScroll();") };
div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

}
}
}

this.handle(delta) = function {
if (delta < 0) {
div_dn_obj.onscroll = function() { eval(scrollname + ".scrollDown();") };
}
else {
div_up_obj.onscroll = function() { eval(scrollname + ".scrollUp();") };
}
}


this.stopScroll = function() {
clearTimeout(this.timeoutID);
}

this.scrollUp = function() {
if (this.div_obj) {
this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
this.div_obj.scrollTop = this.scrollCursor;
this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
}
}

this.scrollDown = function() {
if (this.div_obj) {
this.scrollCursor += this.speed;
this.div_obj.scrollTop = this.scrollCursor;
this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
}
}

this.resetScroll = function() {
if (this.div_obj) {
this.div_obj.scrollTop = 0;
this.scrollCursor = 0;
}
}
}


Hier noch einmal der Link mit der neuen Version. Und wie kann ich den Scrollbalken der jetzt auf einmal erschienen ist wieder verstecken!?

HTML Template
Mit Zitat antworten