Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

onscroll und xthml strict

Empfohlene Antworten

Veröffentlicht

Hhabe ein riesengroßes Projekt nun fast fertig.

Der Kunde möchte nun, dass sein Menü beim Srollen des Browsers in Y-Richtung "mitfährt" (ich hasse sowas aber egal ;))

Tja, da ich mein ganzes Design mit doctype "strict" aufgebaut habe zerschießt es mir selbiges wenn ich den doctype ändere im IE (!)

Wie kann ich trotzdem ein "body onscroll" event einführen, das auf das Scrollen des Browserfensters reagiert?

Ich dachte an prototype.js, aber da finde ich leider nichts.

Wäre dankbar für jeden Hint

Viele Grüße

Der Kunde möchte nun, dass sein Menü beim Srollen des Browsers in Y-Richtung "mitfährt" (ich hasse sowas aber egal ;))

Mach es doch als position: fixed. Da der IE das aber nicht kann, brauchst du das noch dazu.

Sry für meine Ausdrucksweise aber:

O.............

M.............

G..............

Gibts eigentlich irgendwas was Du nicht weisst?

Hallo,

du kannst auch das onScroll-Event per JavaScript hinzufügen, also ohne es als Attrubut im body-Tag anzugeben.


...

    <script type="text/javascript"><!-- // <![CDATA[

    function onScroll(){

        //todo on scroll event

    }


    // add onscroll-event

    if (window.addEventListener) {

        window.addEventListener("scroll", onScroll, false);

    } else if (window.attachEvent){

        window.attachEvent("onscroll", onScroll);

    }

    //]]> --></script>

...

Das ist auch XHTML-Strict. Per CSS wäre es eleganter, aber da du ja sowieso JavaScript verwendest, spielt es keine Rolle...

Gruß

xmurrix

Ich danke! Es läuft nun endlich.

Vielen Dank

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.