jQuery stick div on scroll

50pesos

New Member
I have a top fixed div and then a main frame which contains two divs inside (left and right).I want to make the right div stick just under the top bar on scroll.I've put up what I have here:http://jsfiddle.net/mhD9Y/2/\[code\]$(document).ready(function(){var window_top = 41 - $(window).scrollTop(); var div_top = $('#stop_scroll').offset().top; if (window_top > div_top) $('#right').addClass('stick'); else $('#right').removeClass('stick');}); .stick { position: fixed !important; top: 41px !important;z-index: 5 !important; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; transition: all 1s ease; }\[/code\]The thing is that the script doesn't kick in at all. thanks
 
Back
Top