Calling function after .load (Jquery)
- by Matt
Having a little difficulty getting a function to call after a .load:
$(function(){
$('a.pageFetcher').click(function(){
$('#main').load($(this).attr('rel'));
});
});
The page loads, but the functions don't fire:
$(function(){
var $container = $('#container');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.box',
});
});
$container.infinitescroll({
navSelector : '#page-nav',
nextSelector : '#page-nav a',
itemSelector : '.box',
loading: {
finishedMsg: 'Nothing else to load.',
img: 'http://i.imgur.com/6RMhx.gif'
}
},
function( newElements ) {
$.superbox.settings = {
closeTxt: "Close this",
loadTxt: "Loading your selection",
nextTxt: "Next item",
prevTxt: "Previous item"
};
$.superbox();
var $newElems = $( newElements ).css({ opacity: 0 });
$newElems.imagesLoaded(function(){
$newElems.animate({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
);
});
I've attempted to combine them so that the 2nd functions are called after .load (after doing some searching on this site and looking at given answers/examples) but nothing seems to work properly.
Suggestions?