Mit Jquery lässt wieder einmal das CSS so programmieren, damit es wenn es am oberen Ende des Browsers angelangt ist mit dem Scrollbalken mitläuft.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script> <script> $(function () { � var msie6 = $.browser == 'msie' && $.browser.version < 7; � if (!msie6) { var top = $('#comment').offset().top - parseFloat($('#comment').css('margin-top').replace(/auto/, 0)); $(window).scroll(function (event) { // what the y position of the scroll is var y = $(this).scrollTop(); � // whether that's below the form if (y >= top) { // if so, ad the fixed class $('#comment').addClass('fixed'); } else { // otherwise remove it $('#comment').removeClass('fixed'); } }); } � }); </script> |
Jquery – the greatest thing ever 🙂
Fix für IE6 da er position: fixed; nicht unterstützt folgenden Code im Html eintragen:
1 2 3 4 5 |
<!--[if lt IE 7]> <style type="text/css"> * div.fixed {position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));} </style> <![endif]--> |
Dein Kommentar
An Diskussion beteiligen?Hinterlasse uns Deinen Kommentar!