Jquery 如何使colorbox内联图像,在视图中使用colorbox tigger创建,单击打开下一个图像

Jquery 如何使colorbox内联图像,在视图中使用colorbox tigger创建,单击打开下一个图像,jquery,triggers,switch-statement,colorbox,next,Jquery,Triggers,Switch Statement,Colorbox,Next,我在视图中创建了一些图库,使用了colorbox触发器,其中包括图像、标题、评级按钮。一切正常,图像链接到一个节点。我希望我为colorbox image galery使用默认设置,这样当我单击image时,它将打开gallery中的下一幅图像。我完全卡住了,我在inet上搜索了3天,什么也没找到。我尝试在colorbox overlay中创建一个可点击的图像,该图像将切换到下一个gallery页面,并尝试了如下不同的代码变体: <script type="text/javascript"

我在视图中创建了一些图库,使用了colorbox触发器,其中包括图像、标题、评级按钮。一切正常,图像链接到一个节点。我希望我为colorbox image galery使用默认设置,这样当我单击image时,它将打开gallery中的下一幅图像。我完全卡住了,我在inet上搜索了3天,什么也没找到。我尝试在colorbox overlay中创建一个可点击的图像,该图像将切换到下一个gallery页面,并尝试了如下不同的代码变体:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/sites/all/libraries/colorbox/colorbox/jquery.colorbox-min.js"></script>
 <script type="text/javascript"> 
$(document).ready(function() {
   $("#nextlink").click(function() {
   $.colorbox.next();
   });
 });  

$(文档).ready(函数(){
$(“#nextlink”)。单击(函数(){
$.colorbox.next();
});
});  

当我点击nextlink时,什么也没发生。虽然“上一个”和“下一个”按钮按我所希望的方式工作,但我没有成功地处理它们的代码。

您是否已验证您的事件处理程序正在启动?此外,如果这是来自具有href属性的锚元素,则必须处理默认行为

$(document).ready(function() {
   $("#nextlink").click(function(e) {
       $.colorbox.next();
       e.preventDefault();
   });
});
在您尝试为文档分配事件处理程序时,文档中是否存在您的“#nextlink”?如果没有,则应使用实时事件(或更新jQuery版本,并使用更新的方法处理事件委派)

$(document).ready(function() {
   $("#nextlink").live('click', function(e) {
       $.colorbox.next();
       e.preventDefault();
   });
});