2012-02-06 102 views
0

我有一个$(文件)。就绪监听器在这个非常基本的代码(“请求的内容不能被加载。”):的fancybox 2未能显示AJAX内容

 $('#contact-us-button').fancybox({ 
      padding: 20, 
      beforeLoad: function() { 
          $("#slideshow").data('nivoslider').stop(); 
         }, 
      afterClose: function() { 
          $("#slideshow").data('nivoslider').start(); 
         } 
     }); 

     $('.get-a-quote').fancybox({ 
      padding: 20, 
      beforeLoad: function() { 
          $("#slideshow").data('nivoslider').stop(); 
         }, 
      afterClose: function() { 
          $("#slideshow").data('nivoslider').start(); 
         } 
     }); 

尽管HTML:

<a id="contact-us-button" href="impianto/get-a-quote-form.php"></a> 

[...]

<div class="product"> 
<h1>Ferrari California</h1> 
<a href="dettaglio.php?id=7"> 
<img src="images/showcase/ferrari-california-showcase.jpg" /> 
</a> 
<a class="get-a-quote" href="impianto/get-a-quote-form.php?id=7"></a> 
</div> 

的fancybox正确结合,但显示了地方我表单该消息。类名和ID之间没有冲突。有任何想法吗?请注意,Fancybox 1.3.4的行为与大致相同的代码(不同的选项)是正确的。

回答

3

尝试添加fancybox.ajax类到你的链接像

<a id="contact-us-button" class="fancybox.ajax" href="impianto/get-a-quote-form.php"></a> 

<a class="get-a-quote fancybox.ajax" href="impianto/get-a-quote-form.php?id=7"></a> 
+0

工程就像一个魅力!谢谢! – 2012-02-09 10:22:47

0

尝试使用属性“类型”:“IFRAME”如果你想它里面显示另一个网页的内容它就像是另一个页面的窗口。

像这样的事情在你的< head>标签:

<script type="text/javascript"> 
    $(document).ready(function() { 
      $(".fancybox").fancybox({ 
       'type'   : 'iframe' 
      }); 
     }); 
</script> 

而且它可能是明显的,但如果没有......有了这个特定的JavaScript实现“的fancybox”类的链接,弹出的链接,你的链接到火一个弹出窗口将设置类匹配上面的JavaScript类名称,如:

<a href="webpage_URL_to_show_in_popup.php" class="fancybox">Link</a>