• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Javascript geht nach Request nichtmehr!

Status
Für weitere Antworten geschlossen.

sensi

Neues Mitglied
Hallo,

Ich probier jezt schon Stunden rum aber ich bekomm es nicht hin.

Kann mir jemmand bitte verraten wieso dieser Code nach dem Request nichtmehr tut?

Code:
function init_dw_Scroll() {
    var wndo = new dw_scrollObj('wn', 'lyr1');
}
function dw_scrollObj(wndoId, lyrId, horizId) {
    var wn = document.getElementById(wndoId);
    this.id = wndoId; dw_scrollObj.col[this.id] = this;
    this.animString = "dw_scrollObj.col." + this.id;
    this.load(lyrId, horizId);
    wn.onmousewheel = dw_scrollObj.doOnMouseWheel;
}
 
dw_scrollObj.col = {};
dw_scrollObj.prototype.on_load = function() {}
dw_scrollObj.prototype.on_scroll_start = function() {}
dw_scrollObj.prototype.load = function(lyrId, horizId) {
 
    var wndo, lyr;
    this.lyr = lyr = document.getElementById(lyrId);
    if ( !dw_scrollObj.printEnabled ) {
        this.lyr.style.position = 'absolute';
    }
    this.lyrId = lyrId;
    this.horizId = horizId || null;
    wndo = document.getElementById(this.id);
    this.y = 0; this.x = 0; this.shiftTo(0,0);
    this.getDims(wndo, lyr);
    lyr.style.visibility = "visible";
    this.ready = true; this.on_load();
}
dw_scrollObj.prototype.shiftTo = function(x, y) {
    if (this.lyr) {
        this.lyr.style.left = (this.x = x) + "px";
        this.lyr.style.top = (this.y = y) + "px";
    }
}
 
dw_scrollObj.prototype.getDims = function(wndo, lyr) {
    this.wd = this.horizId? document.getElementById( this.horizId ).offsetWidth: lyr.offsetWidth;
    this.maxX = (this.wd - wndo.offsetWidth > 0)? this.wd - wndo.offsetWidth: 0;
    this.maxY = (lyr.offsetHeight - wndo.offsetHeight > 0)? lyr.offsetHeight - wndo.offsetHeight: 0;
}
 
 
dw_scrollObj.prototype.scroll = function() {
    var now = new Date().getTime();
    var d = (now - this.lastTime)/1000 * this.speed;
    if (d > 0) {
        var x = this.x + Math.round(this.fx * d); var y = this.y + Math.round(this.fy * d);
        if ( ( this.fx == -1 && x > -this.maxX ) || ( this.fx == 1 && x < 0 ) ||
                ( this.fy == -1 && y > -this.maxY ) || ( this.fy == 1 && y < 0 ) )
       {
            this.lastTime = now;
            this.shiftTo(x, y);
            this.on_scroll(x, y);
        } else {
            clearInterval(this.timerId); this.timerId = 0;
            this.shiftTo(this.endX, this.endY);
            this.on_scroll(this.endX, this.endY);
            this.on_scroll_end(this.endX, this.endY);
        }
    }
}
 
dw_scrollObj.prototype.doGlideScroll = function() {
    var elapsed = new Date().getTime() - this.startTime;
    if (elapsed < this.slideDur) {
        var x = this.startX + Math.round( this.distX * Math.sin(this.per*elapsed) );
        var y = this.startY + Math.round( this.distY * Math.sin(this.per*elapsed) );
        this.shiftTo(x, y);
        this.on_glidescroll(x, y);
    } else {
        clearInterval(this.timerId); this.timerId = 0; this.sliding = false;
        this.shiftTo(this.destX, this.destY);
        this.on_glidescroll(this.destX, this.destY);
        this.on_glidescroll_stop(this.destX, this.destY);
        if ( this.distX && (this.destX == 0 || this.destX == -this.maxX)
          || this.distY && (this.destY == 0 || this.destY == -this.maxY) ) {
            this.on_glidescroll_end(this.destX, this.destY);
        }
    }
}
 
dw_scrollObj.handleMouseWheel = function(id, delta) {
    var wndo = dw_scrollObj.col[id];
    var x = wndo.x;
    var y = wndo.y;
    wndo.on_scroll_start(x,y);
    var ny;
    ny = 12  * delta + y
    ny = (ny < 0 && ny >= -wndo.maxY)? ny: (ny < -wndo.maxY)? -wndo.maxY: 0;
    wndo.shiftTo(x, ny);
}
 
dw_scrollObj.doOnMouseWheel = function(e) {
    var delta = 0;
    if (!e) e = window.event;
    if (e.wheelDelta) { /* IE/Opera. */
        delta = e.wheelDelta/120;
        //if (window.opera) delta = -delta; // not needed as of v 9.2
    } else if (e.detail) { // Mozilla
        delta = -e.detail/3;
    }
    if (delta) { // > 0 up, < 0 down
        dw_scrollObj.handleMouseWheel(this.id, delta);
    }
    if (e.preventDefault) e.preventDefault();
    e.returnValue = false;
}

Kann sein das das er ein paar Fehler hat weil ich ihn aussortiert und verkleinert hab zum testen, vor dem Request tut er auf jedenfall, abändern tu ich das dann im fehlerfreien Code, von daher möcht ich jezt kein Fehlerbericht :)

mfg Sensi
 
Werbung:
Damit kann glaube ich keiner etwas anfangen. Zeig mal die Seite wo du den Code verwendest. Und prüfe im Firefox die JavaScript-Konsole beim Ausführen des Codes - dürfte sehr aufschlussreich sein.
 
Status
Für weitere Antworten geschlossen.
Zurück
Oben