I use AJAXify on the site I'm working on to achieve page transitions, and I experience weird behavior with jQuery.
My code is:
HTML (I fade through the background using jQuery)
<div id="backgrounds">
<img src="/assets/Uploads/hpbg3.jpg" alt="" class="bodybackground">
<img src="/assets/Uploads/hpbg2.jpg" alt="" class="bodybackground">
<img src="/assets/Uploads/hpbg4.jpg" alt="" class="bodybackground">
<img src="/assets/Uploads/hpbg5.jpg" alt="" class="bodybackground">
</div>
JQuery
$('.otherClass').each(function() {
$('#backgrounds').fadeOut(function(){
alert('fade');
});
});
$('#main .container.homepageClass').each(function() {
$('#backgrounds').fadeIn();
});
CSS
#backgrounds {display: none; position: absolute; left: 50%; margin-left: -714px;}
My div disappears correctly when I load a page at a URL, and not a link to it via an AJAX link (and I get a warning), however, when I link to it through AJAXified navigation, it will happen, but I still get a warning. so the fadeOut () function definitely starts.
When I remove the absolute positioning from CSS and the link to the page via AJAX, my div disappears when I need it (and I get a warning). This seems to cause a problem with the absolute positioning of the div.
FadeIn() AJAX . fadeOut, .
?