fadein - Hide fixed div when footer is in view and show when footer isnt in view? (jQuery function) -
i have query have fixed div contact details on show until footer in view fadeout. when footer out of view when user scrolls up, fixed div fadesin. have had @ examples , using own div tags , styling , nothing happens. example have used is:
$('#footer').appear(); $('#footer').on('appear', function(){ $('#fixed_div').fadeout(); }); $('#footer').on('disappear', function(){ $('#fixed_div').fadein(); }); html-basic
<div id="footer"> <div class="footer-wrapper"> footer details here </div> </div> <div id="fixed_div"> <ul> <li><h1>details here</h1></li> <li><h1>details here</h2></li> </ul> </div> css -
#call_to_action { bottom:0; position:fixed; padding:5px 0px 8px; width:100%; background:#000; z-index:3000; } #footer { position:absolute; width:100%; min-width:320px; color:#fff; background:#000; overflow:hidden; } footer main footer @ bottom , fixed div positioned @ bottom:0; when user scrolls.
can advise me going wrong?
thanks!
you can create script this:
var secondval = $('#footer').offset().top; $(window).scroll(function(){ var firstval = $(document).scrolltop(); if(firstval >= secondval) { $('#fixed_div').fadeout(); } });
Comments
Post a Comment