1

ページの上部に到達したら、div 変更クラスを修正しようとしています。

このJavaScriptコードがあります。

<script type="text/javascript">
    $(function () {

        var top = 200;
        var y = $(this).scrollTop();

        if (y >= top) {
            // if so, add the fixed class
            $('#kolonne-v').addClass('fixed');
        } else {
            // otherwise remove it
            $('#kolonne-v').removeClass('fixed');
        }
    });
</script>

私は何を間違っていますか?

4

1 に答える 1