2012-10-29 51 views
-1

我试图用Fancybox 2创建一个内联内容库,并且我失败了。Fancybox2内联内容库

我在网上查了一些其他的资源,他们似乎表明这样做比较容易,但是,我似乎无法得到它的工作。

这里是我的小提琴:

http://jsfiddle.net/beefchimi/jtxHd/2/

现在,我觉得捣鼓没有加载的资源,所以这就是一个问题。但即使资源不起作用,我也会遇到fancybox错误。

资源:

http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js?v=2.1.3 http://fancyapps.com/fancybox/source/jquery.fancybox.css?v=2.1.3

任何帮助将不胜感激。

编辑:因此,我无法提交我的问题,而不包括一些代码,因为链接到的jsfiddle是不行的,所以,这里是我的标记和的fancybox初始化,这你还会发现在的jsfiddle:

HTML:

<section><!-- Gallery 1 |begin| --> 

    <!-- Inline post-1 --> 
    <article> 
     <a href="post-1" class="inlinepopup" rel="gallery1">Gallery 1: post-1 &gt; post-2 &gt; post-3</a> 
     <div id="post-1">Inline content for #post-1. Group is Gallery 1.</div> 
    </article> 

    <!-- Inline post-2 --> 
    <article> 
     <a href="post-2" class="inlinepopup" rel="gallery1">Gallery 1: post-1 &lt; post-2 &gt; post-3</a> 
     <div id="post-2">Inline content for #post-2. Group is Gallery 1.</div> 
    </article> 

    <!-- Inline post-3 --> 
    <article> 
     <a href="post-3" class="inlinepopup" rel="gallery1">Gallery 1: post-1 &lt; post-2 &lt; post-3</a> 
     <div id="post-3">Inline content for #post-3. Group is Gallery 1.</div> 
    </article> 

</section><!-- Gallery 1 |end| --> 

<section><!-- Gallery 2 |begin| --> 

    <!-- Inline post-4 --> 
    <article> 
     <a href="post-4" class="inlinepopup" rel="gallery2">Gallery 2: post-4 &gt; post-5</a> 
     <div id="post-4">Inline content for #post-4. Group is Gallery 2.</div> 
    </article> 

    <!-- Inline post-5 --> 
    <article> 
     <a href="post-5" class="inlinepopup" rel="gallery2">Gallery 2: post-4 &lt; post-5</a> 
     <div id="post-2">Inline content for #post-5. Group is Gallery 2.</div> 
    </article> 

</section><!-- Gallery 2 |end| --> 

的jQuery:

$(document).ready(function() { 

    $('a.inlinepopup').fancybox({ 
     'width'   : '75%', 
     'height'   : '75%', 
     'autoScale'  : false, 
     'type'   : 'inline' 
    }); 

}); 

回答

2

如果您链接到您的在线内容,您东东d包括一个#在的href

开头,以便更改href="post-1"href="#post-1"

在上下文中应该是这样的:

<!-- Inline post-1 --> 
<article> 
    <a href="#post-1" class="inlinepopup" rel="gallery1">Gallery 1: post-1 &gt; post-2 &gt; post-3</a> 
    <div id="post-1">Inline content for #post-1. Group is Gallery 1.</div> 
</article> 

这可能不是唯一的错误,但它是第一个需要关注的人。同时检查Firebug或Web Inspector中的任何JS错误。

+0

omg对我来说这是一个愚蠢的疏忽。我是怎么想到的......好吧,非常感谢Alex,你已经解决了我的问题:)我还有其他几个烦恼正在发生,但这些都是我想要的新问题。再次感谢! – beefchimi