1
<div class="contents">
<?php if (have_posts()) :while (have_posts()) : the_post();?>

<div class="post"></div>
<div class="post"></div>
<div class="post"></div>
<div class="post"></div>

<?php endwhile; ?>

</div>

<div class="ajaxLoad">
<?php next_posts_link('もっと見る'); ?>
</div>

<script>
$(function(){
    $.autopager({
        content : '.post',
        link    : '.ajaxLoad a',
        autoLoad: false,
        load: function(current, next) {
            if( current.page >= <?php echo $wp_query->max_num_pages; ?> ){ $('.ajaxLoad').hide(); }
        }
    });
    $('.ajaxLoad a').click(function(){
        $.autopager('load');
        return false;
    });
});

WordPress プラグインwp-jquery-lightboxを使用してます
ページネーションにjquery-autopagerを使用してますが
2ページ目以降にlightboxが効かなくなります
お願いできますか

1 件の回答 1

1

ajax で読み込んだ dom には、lightbox イベントが貼られていないことが原因だと考えます。
よって dom を読み込んだあとに、再度 lightbox を宛てることで、発動するはずです。

ただ、autopager と lightbox について詳しくないので、ajax読み込み後の判定と、lightbox の実行については、別途ライブラリ等でご確認ください。

もしかすると下記で動くかも……。

  $.autopager({
        ......
        load: function(current, next) {
            ......
            doLightBox()
        }
    });

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。