Opa,
I have a div on the side sidebar_right
, when scrolling the page it should go to the fixed footer, I'm using it like this:
$(function () {
var jElement = $('#sidebar_right');
$(window).scroll(function(){
if ( $(this).scrollTop() > 700 )
{
jElement.fadeIn(500);
jElement.css({
'position':'fixed',
'top':'60%',
'z-index':'999',
'width':'100%',
'left':'0',
'overflow':'scroll',
'height':'300px',
});
}else{
//jElement.fadeOut(500); Não usado
jElement.css({
'position':'relative',
'top':'auto',
'overflow':'hidden',
'height':'auto',
'z-index':'999',
});
}
});
});
It works normally, but without the fadein
effect, fadein
only occurs when I add fadeout
, there else
. I can not add fadeout
because it is the same div.
What's wrong?