jquery - How to make a sticky ad on sidebar? -
hi website http://cafun.cf have div containing ad @ bottom of sidebar. want slide down when user scrolls till meets footer.
i've tried many solutions using jquery, not working right way (i don't know jquery!)
this structure :
<aside> <!--other divs 'asider' class --> <div class="asider"> <div id="side_ad"> <!-- ad code--> </div> </div> </aside>
please me this... thanks!
note: want whole 'asider' class slide down.
i think need this
$stick = $('#marker'); jquery(function($) { function fixdiv() { var $cache = $('#getfixed'); if ($(window).scrolltop() > $stick.offset().top) $cache.css({ 'position': 'fixed', 'top': '10px' }); else $cache.css({ 'position': 'relative', 'top': 'auto' }); } $(window).scroll(fixdiv); fixdiv(); });
raplace value of $stick = $('#marker');
element trigger fixed element or pixels. in case there plenty of examples fix div on scroll
Comments
Post a Comment