jQuery Slimbox 未正确请求文件
我正在使用 jQuery slimbox 及其 API。
这是我的 JavaScript,它通过 JSON 获取图像路径,然后通过它的 API 启动 slimbox。
$('#main-container').append('<span id="check-our-adverts">Check our Adverts</span>');
var advertImages = [];
$.getJSON( config.basePath + 'get-adverts/', function(images) {
advertImages = images;
});
$('#check-our-adverts').click(function() {
console.log(advertImages);
$.slimbox(advertImages, 0);
});
JSON 返回 ["\/~wwwlime\/assets\/images\/adverts\/advert.jpg","\/~wwwlime\/assets\/images\/adverts\/advert2.jpg"]
。
实际页面位于此处。单击青蛙旁边的顶部红色框。如果您有控制台,请检查它是否返回了 JSON。
当我使用 实时 HTTP 标头 查看请求时,slimbox 似乎正在请求 vanquish.websitewelcome.com /
没有别的。
这导致了 slimbox 的推出,并且它永远在颤动旋转。
什么可能导致这个问题?谢谢
更新
我在 JSON 回调中添加了这个
$.each(images, function(i, image) {
$('body').append('<a href="' + image + '">link</a>');
});
并且单击这些链接将我直接带到图像...什么给出了?
I am using jQuery slimbox with it's API.
Here is my JavaScript that gets image paths via JSON, and then launches the slimbox via it's API.
$('#main-container').append('<span id="check-our-adverts">Check our Adverts</span>');
var advertImages = [];
$.getJSON( config.basePath + 'get-adverts/', function(images) {
advertImages = images;
});
$('#check-our-adverts').click(function() {
console.log(advertImages);
$.slimbox(advertImages, 0);
});
The JSON is returning ["\/~wwwlime\/assets\/images\/adverts\/advert.jpg","\/~wwwlime\/assets\/images\/adverts\/advert2.jpg"]
.
The actual page is here. Click top red box next to the frog. If you have a console, check it for the JSON returned.
When I view the request using Live HTTP Headers, it seems slimbox is requesting vanquish.websitewelcome.com/
and nothing else.
This is resulting in the slimbox being launched, and it's throbber spinning forever.
What could be causing this problem? Thanks
Update
I added this inside the JSON callback
$.each(images, function(i, image) {
$('body').append('<a href="' + image + '">link</a>');
});
And clicking those links takes me directly to the image... what gives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 slimbox 不是 100% 熟悉,但 api 说该方法采用数组数组,因此我相信,您从 JSON 的返回应该看起来更像是
让您调用 slimbox
让我知道这是否有帮助?
I am not 100% familiar with slimbox but the api says that the method takes and array of arrays, so your return from JSON should, i believe, look more like
making you call to slimbox
let me know if that helps?