/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(document).ready(function() { var theLoc = $('#leftNav').position().top; $(window).scroll(function() { if(theLoc >= $(document).scrollTop()) { if($('#leftNav').hasClass('fixed')) { $('#leftNav').removeClass('fixed'); } } else { if(!$('#leftNav').hasClass('fixed')) { $('#leftNav').addClass('fixed'); } } }); });
URL: http://www.josephgiuffrida.com/
Comments
