Jquery 单击打开下一个内联色盒Div

Jquery 单击打开下一个内联色盒Div,jquery,lightbox,colorbox,inline,Jquery,Lightbox,Colorbox,Inline,我有两张图片,当我点击它们时,它会打开相应的#DIV,效果很好。我正在使用colorbox jQuery插件 但我甚至添加了两个链接ajNext和ajPrev 我想用它们打开下一个或上一个内联DIV。是否可以将它们作为分组DIV打开,有点像gallery next prev功能。请帮帮我:) 和我的HTML: <li><a class="inline" href="#profile1"><img src="car1.jpg"></a></li

我有两张图片,当我点击它们时,它会打开相应的#DIV,效果很好。我正在使用colorbox jQuery插件

但我甚至添加了两个链接ajNext和ajPrev

我想用它们打开下一个或上一个内联DIV。是否可以将它们作为分组DIV打开,有点像gallery next prev功能。请帮帮我:)

和我的HTML:

<li><a class="inline" href="#profile1"><img src="car1.jpg"></a></li>
<li><a class="inline" href="#profile2"><img src="car2.jpg"></a></li>

<div id="inline_profiles"'>
            <div id="profile1" class="profilex">
                <img src="images/kala-mela/car1_1.jpg">
                <p><strong>Prasanna R. Gogilwar. 111</strong></p>
                <p>111 Prasanna loves birds and his favourite is the Hornbill. He mentioned that the side lights of the Nano bear a striking resemblance to the bird and the thought of owning a Nano with his design on it would be extremely exciting. He would drive is everywhere so that people get a chance to admire his work.</p>
                <a id="ajPrev"></a>
                <a id="ajNext"></a>
            </div>

            <div id="profile2" class="profilex">
                <img src="images/kala-mela/car1_1.jpg">

                <p><strong>Prasanna R. Gogilwar. 2222</strong></p>
                <p>222 Prasanna loves birds and his favourite is the Hornbill. He mentioned that the side lights of the Nano bear a striking resemblance to the bird and the thought of owning a Nano with his design on it would be extremely exciting. He would drive is everywhere so that people get a chance to admire his work.</p>
                <a id="ajPrev"></a>
                <a id="ajNext"></a>
            </div>
        </div>
  • id
    必须是唯一的

    $(".inline").colorbox({inline:true, width: '50%', rel: 'profilex'});
    
    $('.ajPrev').on('click', function(){
        $.fn.colorbox.prev();
    });
    $('.ajNext').on('click', function(){
        $.fn.colorbox.next();
    });
    
    演示:

    <img src="car2.jpg">
    
    <a id="ajPrev"></a>
    <a id="ajNext"></a>
    
    $(".inline").colorbox({inline:true, width: '50%', rel: 'profilex'});
    
    $('.ajPrev').on('click', function(){
        $.fn.colorbox.prev();
    });
    $('.ajNext').on('click', function(){
        $.fn.colorbox.next();
    });