ESEMPIO funzionante.codice:<script type="text/javascript"> var finestra = this; $.fn.followTo = function ( pos ) { var $this = this, $window = $(finestra); $window.scroll(function(e){ if ($window.scrollTop() > pos) { $this.css({ position: 'absolute', top: pos }); } else { $this.css({ position: 'fixed', top: 0 }); } }); }; $('#finestra').followTo(250); <script> <style type="text/css"> #finestra { background:#ace; padding:20px; width:200px; position:fixed; top:0; left:0; } </style> <body> <div id="finestra"> Io ti seguo solo fino ad un certo punto... </div> </body>
![]()