0
我的加载动态内容的脚本是这样的并且工作完美,问题是我不能将脚本包含到动态内容中。 :脚本不能在ajax内容中工作
$( '导航李一')点击(函数(){
$(this).addClass("green");
$('nav a').not(this).removeClass("green");
var toLoad = $(this).attr('href')+' #content';
$('#content').hide('fast',loadContent);
$('#load').remove();
$('#main').append('<span id="load">LOADING...</span>');
$('#load').fadeIn('normal');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content').load(toLoad,'',showNewContent());
}
function showNewContent() {
$('#content').show('slow',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
return false;
// this is the script that i want to trigger
$('.lightbox').lightBox();
});
这样是不行的,我也尝试委托模式是这样的:
$('#content').delegate('img', 'click', light);
var light = $('.lightbox').lightBox();
任何人都可以帮我吗?
在此先感谢。
没有工作:( – niceoutput 2012-02-19 13:44:14