jQuery - Can someone help stitching jQuery code with .ajaxComplete()?
Posted
by Kenny Bones
on Stack Overflow
See other posts from Stack Overflow
or by Kenny Bones
Published on 2010-04-30T09:12:00Z
Indexed on
2010/04/30
9:37 UTC
Read the original article
Hit count: 166
Hi, so I've got this content loader that replaces content within a div with content from a separate page. But the content that arrives contains a menu that uses jQuery and this is not working. Someone told me I need to reinitialize the code. But how do I do that? I've looked into .ajaxComplete(), but I don't really get how I'm supposed to stitch that together with my existing code?
$('.dynload').live('click',
function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').fadeOut('fast',loadContent);
$('#ajaxloader').fadeIn('normal');
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').fadeIn('fast',hideLoader());
//Cufon.replace('h1, h2, h3, h4, .menuwrapper', { fontFamily:
'advent'});
}
function hideLoader() {
$('#ajaxloader').fadeOut('normal');
}
return false;
});
This is the code I'm using for the jQuery menu:
$().ready(function() {
$('#kontrollpanel .slidepanels').kwicks({
min : 42,
spacing : 3,
isVertical : true,
sticky : true,
event : 'click'
});
});
Also, notice how I try to call Cufon as well within the first function? That doesn't really work either, could that be reinitialized as well? Would really appreciate any help at all..
© Stack Overflow or respective owner