I found this script here on SO and I've been trying to implement it into my project however I'm still new to jQuery and need a little help.
This is the script: http://jsfiddle.net/9erk2/
I'm trying to get this effect but on an externally loaded html div section and it's not working.
I'm thinking it has something to do with the fact that the div doesn't exist on load so I need to use the .live() method. Is this right, how would I go about doing this.
Any help would be really appreciated.
Thanks!
Try this in conjunction with the css and html code provided in the fiddle.
<script>
$window.delegate("#divID", "scroll", function(event){
scrollTop = $window.scrollTop(),
topPosition = Math.max(0, sidebarTop - scrollTop),
topPosition = Math.min(topPosition, (footerTop - scrollTop) - sidebarHeight);
$sidebar.css('top', topPosition);
});
</script>