[jQuery] Reload Javascript file
Hi everybody,
i wrap an div with the id="content" from figurative.php with ajax on
load it into my index.php
it looks then index.php#figurative
But i have a problem with it, because the figurative.php load pictures
from a folder and i will use the fancybox to show the pictures.
the problem is, that the fancybox did not work, because i think i have
to reload the javascript file. becaue on index.php is no gallery
avalible and so the function is not working.
this is my ajax reload function:
$(document).ready(function() {
$('#content').wrap('<div id="content-wrapper"></div>');
function pageload(hash) {
if(hash) {
$("#content-wrapper").load(hash + ".php #content",'',function(){
$('#content-wrapper').show('normal');
$('#load').fadeOut('normal');
});
} else {
$("#content-wrapper").load("index.php #content"); //default
}
}
$.historyInit(pageload);
$('#nav li a').click(function(){
var hash = $(this).attr('href');
hash = hash.replace(/^.*#/, '');
hash = hash.substr(0,hash.length-4);
$('#content-wrapper').hide('fast',function(){$.historyLoad(hash)});
$('#load').remove();
$('#wrapper').append('<span id="load">LOADING...</span>');
$('#load').fadeIn('normal');
return false;
});
});
you can see the problem on:
http://www.guido-grun.de/Site/en/index.php
http://www.guido-grun.de/Site/en/index.php#figurative
Hope everybody has a solution for that
thanks Guido