Trying to show/hide a div
using jQuery isn't working when the div
is wrapped in a position:fixed
element. However, changing it to position:relative
makes the show/hide function work again.
You can see an example of the working version with position:relative here.
And here is the non-working version with position:fixed, where the show/hide
functionality doesn't display properly.
var flag = 0;
var leftValue;
$('#button').on('click',function(){
flag = !flag;
leftValue = flag ? 100 : 0;
$('#right').animate({ left: leftValue }, 'slow', function() {
$('#button').text(function(i,v){
return v == 'Close' ? 'Menu' : 'Close';
});
});
});
/* show/hide DIV when passed the other div */
$(document).scroll(function(){
var vis = ($(document).scrollTop() > ($('.passedMe').offset().top+$('.passedMe').height()));
$('.showHide').css('display', vis?'':'none')
});
/* show/hide DIV when passed the other div */
Any ideas on how to resolve this issue?