Frage

Ich versuche, ein Div dazu zu bringen, dem Fenster scrollTop zu folgen.

In FF sieht es gut aus, aber in IE (6,7) springt die Animation und führt dazu, dass das Fenster scrollt.

Ich habe versucht, es zu lockern, aber es hat nicht funktioniert.

Mein Code:

        <div style="float:left;width:500px;height:4000px; background-color:Blue;">
        <br/>           
    </div>
    <div id="Div1" style="position:relative; float:left; height:4000px; width:300px;">
        <div id="sidePanel" style="position:absolute; top:0px; left:0px;width:200px; height:200px;  border:solid 1px black;">
            SIDE PANEL<br/><br/>
        <div id="info"></div>
            <br />
            <button id="showCurrTop" onclick="alert($(window).scrollTop());">$(window).scrollTop()</button>
        </div>
    </div>

        $(document).ready(function(){

             $(window).scroll(function () { 
                    var scrollTop = $(window).scrollTop();

                    $("#sidePanel").stop(false,false);
                    $("#sidePanel").animate({"top": scrollTop + 200}, 1000);

                    $("#info").html(scrollTop);

                });
          });
War es hilfreich?

Lösung

Habe eine Lösung gefunden: Floating-Div

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top