0

在使用 AJAX 调用动态加载内容后,我试图让下一个/上一个按钮与 SLIMBOX 库一起使用。

$(document).ready(function() {

$('.content_box').hide();
$('.sf-menuUP a').click(function(){
$('.content_box').fadeIn('slow');
});

var hash = window.location.hash.substr(1);
var href = $('.sf-menuUP li a').each(function(){
    var href = $(this).attr('href');
    if(hash==href.substr(0,href.length-5)){
        var toLoad = hash+'.html #content';
        $('#content').load(toLoad)
    }                                           
});

$('.sf-menuUP li a').click(function(){

    var toLoad = $(this).attr('href')+' #content';
    $('#content').fadeOut('fast',loadContent);
    $('#load').remove();
    $('#wrapper').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').fadeIn('normal',hideLoader());
    }
    function hideLoader() {
        $('#load').fadeOut('normal');
    }
    return false;
});
$("a[rel^='lightbox']").livequery(function(){ 
    $(this).slimbox({/* Put custom options here */}, null, function(el) {
                return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
    }), function() {
        //remove slimbox? this is called when elements no longer match
    }
});

});

slimbox 通过 livequery 反弹,我只是不知道如何重新绑定 slimbox 的下一个/上一个功能。我希望这是足够的信息,我真的需要让它工作。谢谢。

4

1 回答 1

0

您可以在http://www.twozao.com/2010/06/previous-next-functionality-with-php.html中找到一个使用 ajax 的上一个/下一个函数的简单示例。我认为这会对您有所帮助。

于 2010-06-16T09:55:59.820 回答