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