我正在尝试为 Fancybox 安装一个 Knockout 绑定(尽管我不认为这里涉及太多)。我根据此处示例中的代码调用 Fancybox:http: //jsfiddle.net/STgGM/
$.fancybox.open([{
href: value.image(),
title: value.title()
}], {
padding: 0
});
传入的对象如下所示:
{href: "http://example.com/imageurl", title: "Image Title"}
单步执行 fancybox 代码,它不会尝试在脚本的第 855 行显示图像:
if (!type) {
F.coming = null;
//If we can not determine content type then drop silently or display next/prev item if looping through gallery
if (F.current && F.router && F.router !== 'jumpto') {
F.current.index = index;
return F[ F.router ]( F.direction );
}
return false;
}
我现在不完全确定它在寻找什么。F.current
为 nullF.router
且不存在于对象上。
所以,简而言之,我试图通过点击链接来触发 Fancybox,而不需要过多地修改我的标记,或者调用.fancybox()
特定的元素。这似乎是可能的,但它似乎对我不起作用。