我有两张图片,当我点击它们时会打开相应的#DIV。它工作正常。我正在使用colorbox jQuery插件。
但我甚至添加了2个链接ajNext和ajPrev。
我想用它们打开下一个或上一个内联DIV。是否可以将它们打开为分组DIV,有点像画廊下一个上一个功能。请帮助我:)。
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
$(".inline").colorbox({inline:true, width:"1020px", height: "560px"});
$('#ajNext').live('click', function(){
$.fn.colorbox.next();
});
});
和我的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>
答案 0 :(得分:1)
<img src="car2.jpg">
您需要关闭img
元素<img />
<a id="ajPrev"></a>
<a id="ajNext"></a>
id
必须是唯一的
$(".inline").colorbox({inline:true, width: '50%', rel: 'profilex'});
$('.ajPrev').on('click', function(){
$.fn.colorbox.prev();
});
$('.ajNext').on('click', function(){
$.fn.colorbox.next();
});