0
我想在fancybox 2彈出窗口中創建自己的下一個和前一個箭頭。 它包括他們工作正常,但當我點擊他們時,我得到$ .fancybox是未定義的。 我正在使用ajax打開一個頁面。Fancybox未定義
這是我的fancybox初始化代碼:
$(".popup").fancybox ({
maxWidth : 1200,
maxHeight : 550,
width : '90%',
height : '90%',
autoSize : false,
openEffect : 'none',
closeEffect : 'none',
nextEffect: 'none',
prevEffect: 'none',
arrows: false,
padding: 0,
scrolling: 'no',
afterShow: function (e) {
var toolbar = "<div id='next'>Next</div><div id='prev'>Prev</div>";
$(".fancybox-inner").append(toolbar);
}
});
這是我的下一個和以前的代碼:
$("#next").live ("click", function() {
$.fancybox.next();
});
$("#prev").live ("click", function() {
$.fancybox.prev();
});
在一個名爲JavaScript文件popup.js,我有這兩個代碼樣本的重新調整 包含在我稱之爲彈出窗口的頁面上。
出了什麼問題?
啊謝謝!只是想知道,爲什麼代表比活更好? – 2012-03-25 00:15:44
閱讀關於'.live()'的缺點http://api.jquery.com/live/ – JFK 2012-03-25 01:23:52