Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).scroll(function(e){
- var $window = $(window)
- var $authors = $('.author')
- if($authors.length > 0) {
- $authors.each(function(i, e) {
- var $author = $(e)
- var $container = $author.parent().parent()
- var offset = Math.max(0, $window.scrollTop() - $container.offset().top + 50)
- offset = Math.min($container.height() + $container.offset().top - $author.outerHeight() - 50, offset)
- var currentOffset = parseFloat($author[0].style.top)
- if(offset !== currentOffset) {
- $author.css({top:offset})
- }
- })
- }
- }).scroll()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement