只是似乎无法让这种情况发生!
$(".fancy").click(function(event) {
event.preventDefault();
var pic = [];
$('.room-thumbnail').each(function(index) {
pic.push('\'' + 'http://localhost' + $(this).attr('href') + '\'' );
});
var pics = '['+ pic.join(', ')+']';
console.log(pics);
// => ['http://localhost/driver/images/produits/denim/sixthjune-7440/sixthjune-7440.jpg', 'http://localhost/driver/images/produits/denim/sixthjune-7440/sixthjune-7440-back.jpg', 'http://localhost/driver/images/produits/denim/sixthjune-7440/sixthjune-7440-closeup1.jpg', 'http://localhost/driver/images/produits/denim/sixthjune-7440/sixthjune-7440-closeup2.jpg']
$.fancybox(pics, {
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'overlayColor' : '#1D1D1D',
'type' : 'image',
'cyclic': true
});
});
如果我手动输入 href 网址(图片),它可以工作。但是当我通过 fancybox 变量(图片)我得到了 fancybox 错误: - 无法加载请求的内容。- 请稍后再试。-
有人可以告诉我我做错了什么吗?
提前致谢。