這裏有一個教程:http://perishablepress.com/slide-fade-content/從隱藏的div加載內容?
,它提供的代碼是:
$(document).ready(function(){
// Ajax Slide & Fade Content with jQuery @ http://perishablepress.com/slide-fade-content/
$('.more').live('click',function(){
var href = $(this).attr('href');
if ($('#ajax').is(':visible')) {
$('#ajax').css('display','block').animate({height:'1px'}).empty();
}
$('#ajax').css('display','block').animate({height:'200px'},function(){
$('#ajax').html('<img class="loader" src="http://example.com/slide-fade-content/loader.gif" alt="">');
$('#ajax').load('http://example.com/slide-fade-content/slide-fade-content.html.html #'+href,function(){
$('#ajax').hide().fadeIn().highlightFade({color:'rgb(253,253,175)'});
});
});
return true;
});
});
這將從外部文件加載的內容,有沒有辦法做同樣的事情,但加載從內容一個隱藏的div在同一頁上?
檢查出JQuery的LIB您正在使用的「阿賈克斯」部分;) – 2011-12-14 18:11:16