Fancybox无法加载请求的内容。 请稍后再试

<link rel="stylesheet" href="getSkinUrl(''); ?>js/fancybox/source/jquery.fancybox.css?v=2.0.6" type="text/css" media="screen" /> <script type="text/javascript" src="getSkinUrl(''); ?>js/fancybox/source/jquery.fancybox.pack.js?v=2.0.6">  $(document).ready(function() { $("a#image").fancybox(); $("a#image").trigger('click'); $("a#image").hide(); }); 

 <img src="getSkinUrl() ?>images/banner-about-cart.png" alt=""/> 

有任何想法吗? 图像加载我测试没有花哨的插件我可以在网站上看到图像,我也使用magento。

我认为你应该内联指定fancybox类,记住css文件中也有样式代码:

       

如果您尝试以下其中一项,会发生什么?:

  $('#image').trigger('click'); //or $('a[id="image"]').trigger('click'); //? 

使用getSkinUrl()您应该将路径作为参数放在函数中,而不是放在函数之后。 方法中有逻辑,在当前主题中查找您指定的文件,如果它不存在,那么它将回退到默认主题路径。

我们假设您使用自定义主题(命名为custom / theme)。 给定以下文件结构:

 skin/ frontend/ custom/ theme/ images/ new-logo.png default/ default/ images/ new-logo.png logo.png // Good! https://stackoverflow.com/questions/10857849/fancybox-the-requested-content-cannot-be-loaded-please-try-again-later/getSkinUrl('images/new-logo.png'); ?> // returns http://www.example.com/skin/frontend/custom/theme/images/new-logo.png // Good, even though images/logo.png doesn't exist in our custom theme. https://stackoverflow.com/questions/10857849/fancybox-the-requested-content-cannot-be-loaded-please-try-again-later/getSkinUrl('images/logo.png'); ?> // returns http://www.example.com/skin/frontend/default/default/images/logo.png // Bad! This will cause a 404 error! https://stackoverflow.com/questions/10857849/fancybox-the-requested-content-cannot-be-loaded-please-try-again-later/getSkinUrl('') . 'images/logo.png'; ?> // returns http://www.example.com/skin/frontend/custom/theme/images/logo.png 

我应该指出,我认为这不适用于查询字符串?v=2.0.6因此您需要追加:

  

也许这个

 href="https://stackoverflow.com/questions/10857849/fancybox-the-requested-content-cannot-be-loaded-please-try-again-later/banner-about-cart.png" 

应该

 href="https://stackoverflow.com/questions/10857849/fancybox-the-requested-content-cannot-be-loaded-please-try-again-later/getSkinUrl() ?>images/https://stackoverflow.com/questions/10857849/fancybox-the-requested-content-cannot-be-loaded-please-try-again-later/banner-about-cart.png" 

或简单地说

 href="images/https://stackoverflow.com/questions/10857849/fancybox-the-requested-content-cannot-be-loaded-please-try-again-later/banner-about-cart.png" 

检查您是否有正确的路径。 如果javascript被禁用(并且链接尚未隐藏),您可以链接到图像吗?

附注

这个 :

  $("a#image").fancybox(); $("a#image").trigger('click'); $("a#image").hide(); 

可以简化为:

 $("a#image").fancybox().trigger('click').hide(); 

… 纯娱乐 ;)