Jon Silman, Author at We Got This Covered

'; var newStickySidebar = newElement.firstChild; jQuery(newStickySidebar).css('position', 'relative'); jQuery(newStickySidebar).css('margin-bottom', '20px'); jQuery(newStickySidebar).addClass('post-' + postId); jQuery(newStickySidebar).height( jQuery('.alm-single-post.post-' + postId).height() - 20 ); document.querySelector('.the-sidebar').appendChild(newAnchor); document.querySelector('.the-sidebar').appendChild(newStickySidebar); var $sidebar = jQuery('.the-sidebar'), $stickySideAnchor = jQuery('.sticky-sidebar-ad-anchor.post-' + postId), $stickySideContainer = jQuery('.sticky-sidebar-container.post-' + postId), $stickySideUnits = jQuery('.sticky-sidebar-container.post-' + postId + ' .units'); $stickySideContainer.height( jQuery('.alm-single-post' + postId).height() ) jQuery(window).on('scroll', function() { $stickySideContainer.height( jQuery('.alm-single-post.post-' + postId).height() - 20 ); }); })(); }