jQuery Accordion 与 GallerificPlus 组合的冲突
我正在尝试将官方 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;
});
});
这是使用的代码。 我希望有人可以提供一些提示来解决这个问题。
谢谢
I'm trying to combine the official jQuery accordion plugin with another JQ plugin called 'GallerificPlus' (Gallerific & Lightbox in 1).
Unfortunately it doesn't work for me. The GallerificPlus is the one that doesn't work, the accordion works fine. Firebug reports no errors, so this could be anything. It's really frustrating.
<!-- 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>
Here's some JS that customizes a part of the accordion and adds the functionality for
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;
});
});
This is the code is used.
I hope someone can give some tips to solve this issue.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了问题....
显然页面上只能有 1 个 GallerificPlus 图库...
所以我想这会导致 id 冲突
I found the problem....
Apparently There can only be 1 GallerificPlus gallery on the page...
So that's causing a conflict in id's I supose