【问题标题】:Conflict by combining jQuery Accordion with GallerificPlus将 jQuery Accordion 与 GallerificPlus 结合使用的冲突
【发布时间】:2010-10-21 03:45:39
【问题描述】:

我正在尝试将官方 jQuery 手风琴插件与另一个名为“GallerificPlus”的 JQ 插件(Gallerific & Lightbox in 1)结合起来。 不幸的是,它对我不起作用。 GallerificPlus 是不工作的,手风琴工作正常。 Firebug 没有报告任何错误,所以这可能是任何错误。真是令人沮丧。

    <!-- these are the includes for Gallerific PLus -->
    <link href="{$workspace}/css/gallerificPlus.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="{$workspace}/js/functions.js"></script>
    <script type="text/javascript" src="{$workspace}/js/gallerificPlus.js"></script>
    <script type="text/javascript">
    document.write("<style type='text/css'>div.navigation{width:300px;float: left;}div.content{display:block;}</style>");
    </script>

    <!-- These are the includes for accordion -->
    <link href="{$workspace}/css/screen.css" type="text/css" rel="stylesheet" media="screen,projection" />
    <!--[if lt IE 7]>
    <link href="{$workspace}/css/screen-ie6.css" type="text/css" rel="stylesheet" media="screen,projection" />
    <![endif]-->
    <script type="text/javascript" src="{$workspace}/js/jquery-scrollTo.js"></script>
    <script type="text/javascript" src="{$workspace}/js/accordion.js"></script>

     <xsl:choose>
        <xsl:when test="data/resort-view/entry/rooms/item">
           <ul id="accordion">
                 <xsl:for-each select="data/resort-view/entry/rooms/item">
                   <li>
                          <!-- this is the clickable part of the accordion --> 
                          <a href="?section=recent" class="heading">Click me to open the image gallery</a>

                          <!-- here begins the accordion part that is hidden --> 
                           <ul id="view-the-room">
                               <div id="resort-view">
                                <div id="resort-view-details">
                                     <!-- this is the gallerificPlus part which doesnt work -->
                                     <div id="resort-view-img">
                                       <div id="wrapper-for-img">
                                          <div id="gallery" class="content">
                                              <div id="loading" class="loader"></div>
                                              <div id="slideshow" class="slideshow"></div>
                                          </div>
                                       </div>
                                         <div id="resort-view-thumbs">
                                           <div id="thumbs" class="navigation">
                                              <div id="navigation" class="navigation">
                                                  <ul class="thumbs noscript">
                                                      <!-- lightbox image thumbs --> 
                                                      <xsl:if test="room-img-01/filename/text()">
                                                                  <li>
                                                                       <a class="thumb" href="{$workspace}/images/img-uploads/kohlipe-images/{$image-path-001}" 
                                                                       original="{$workspace}/images/img-uploads/kohlipe-images/{$image-path-001}" 
                                                                       title="" description="">
                                                                       <img src="{$workspace}/images/img-uploads/kohlipe-images/{$image-path-001}" class="img resort-view-thumbnail" alt="" />
                                                                       </a>
                                                                  </li>
                                                      </xsl:if>
                                                      <xsl:if test="room-img-02/filename/text()">
                                                                  <li>
                                                                       <a class="thumb" href="{$workspace}/images/img-uploads/kohlipe-images/{$image-path-002}" 
                                                                       original="{$workspace}/images/img-uploads/kohlipe-images/{$image-path-002}" 
                                                                       title="" description="">
                                                                       <img src="{$workspace}/images/img-uploads/kohlipe-images/{$image-path-002}" class="img resort-view-thumbnail" alt="" />
                                                                       </a>
                                                                  </li>
                                                      </xsl:if>
                                                   </ul>
                                               </div>
                                           </div> <!-- end thumbs --> 
                                        </div> <!-- end resort view thumbs--> 
                                      </div><!-- end resortview image -->
                                     </div> <!-- end resortview-details--> 
                               </div><!-- end resort-view --> 
                           </ul>
                   </li>
                </xsl:for-each>
           </ul>
    </xsl:when>

这是一些自定义手风琴的一部分并添加功能的 JS GallerificPlus。

        // some custom JS for accordion and the JS needed for GallerificPlus
    $(document).ready(function() {
        var gallery = $('#gallery').galleriffic('#navigation', {
            delay:                5500,
            numThumbs:            12,
            preloadAhead:         40, // Set to -1 to preload all images
            imageContainerSel:    '#slideshow',
            controlsContainerSel: '#controls',
            titleContainerSel:    '#image-title',
            descContainerSel:     '#image-desc',
            downloadLinkSel:      '#download-link',
            fixedNavigation:       true,
            galleryKeyboardNav:       true,
            autoPlay:               false
        });

        gallery.onFadeOut = function() {
            $('#details').fadeOut('fast');
        };

        gallery.onFadeIn = function() {
            $('#details').fadeIn('fast');
        };

        $('ul#accordion a.heading').click(function() {
            $(this).css('outline','none');
            if($(this).parent().hasClass('current')) {
                $(this).siblings('ul').slideUp('slow',function() {
                    $(this).parent().removeClass('current');
                    $.scrollTo('#accordion',1000);
                });
            } else {
                $('ul#accordion li.current ul').slideUp('slow',function() {
                    $(this).parent().removeClass('current');
                });
                $(this).siblings('ul').slideToggle('slow',function() {
                    $(this).parent().toggleClass('current');
                });
                $.scrollTo('#accordion',1000);
            }
            return false;
        });
    });

这是使用的代码。 我希望有人可以提供一些提示来解决这个问题。

谢谢

【问题讨论】:

  • 当我打开手风琴时,GallerificPlus 插件不起作用。它是不活动的。我尝试定位包含,例如将 GallerificPlus-ones 放在顶部……但这也不起作用。我认为这是某种冲突?我应该去哪里看?
  • 我把答案删了,因为我弄错了,我去看看!
  • 别担心,这很有趣,因为在页面上手风琴的正上方我使用了 GallerificPlus 插件,它就像一个魅力......

标签: javascript jquery accordion lightbox xslt


【解决方案1】:

我发现了问题......

显然页面上只能有 1 个 GallerificPlus 图库... 所以这导致了我认为的 id 冲突

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多