我正在一个网站上工作,该网站在同一页面上需要多个 jQuery 库,并且我使用 Trent Foley 的工作模型 Gallerific。对于一些网站,我已经成功地轻松地使用了缩略图翻转效果和幻灯片交叉淡入淡出版本,但是我很难在每页上实现多个画廊画廊。
一些论坛建议为每个画廊使用不同的 id - 我了解它是如何工作的,并且玩了几个小时但没有成功。我想知道如何将所有这些结合在一起以包含 CSS 和 jQ。
是否有任何工作模型可以成功完成?
这是文章......对于那些熟悉插件的人来说,你会看到很多这样的东西:
HTML
<!-- Start Advanced Gallery Html Containers -->
<div id="gallery" class="content" style="margin-left: -100px;">
<div id="controls" class="controls"></div>
<div class="slideshow-container" style="margin-left: -100px;">
<div id="loading" class="loader"></div>
<div id="slideshow" class="slideshow"></div>
</div>
<div id="caption" class="caption-container"></div>
</div>
<div id="thumbs" class="navigation">
<ul class="thumbs noscript">
<li>
<a class="thumb" name="001" href="images/jim_tattoos/001.JPG" title="001">
<img src="images/jim_thumbs/001.jpg" alt="001" />
</a>
<div class="caption">
<div class="image-title">Alex Cuban Crest</div>
<div class="image-desc"></div>
</div>
</li>
<li>
<a class="thumb" name="001" href="images/jim_tattoos/001.JPG" title="001">
<img src="images/jim_thumbs/001.jpg" alt="001" />
</a>
<div class="caption">
<div class="image-title">Alex Cuban Crest</div>
<div class="image-desc"></div>
</div>
</li>
.....
.....
.....
</ul>
</div>
jQuery
jQuery(document).ready(function($) {
// We only want these styles applied when javascript is enabled
$('div.navigation').css({'width' : '300px', 'float' : 'left'});
$('div.content').css('display', 'block');
// Initially set opacity on thumbs and add
// additional styling for hover effect on thumbs
var onMouseOutOpacity = 0.67;
$('#thumbs ul.thumbs li').opacityrollover({
mouseOutOpacity: onMouseOutOpacity,
mouseOverOpacity: 1.0,
fadeSpeed: 'fast',
exemptionSelector: '.selected'
});
// Initialize Advanced Galleriffic Gallery
var gallery = $('#thumbs').galleriffic({
delay: 2500,
numThumbs: 18,
preloadAhead: 9,
enableTopPager: true,
enableBottomPager: true,
maxPagesToShow: 7,
imageContainerSel: '#slideshow',
controlsContainerSel: '#controls',
captionContainerSel: '#caption',
loadingContainerSel: '#loading',
renderSSControls: true,
renderNavControls: true,
playLinkText: 'Play Slideshow',
pauseLinkText: 'Pause Slideshow',
prevLinkText: '‹ Previous Photo',
nextLinkText: 'Next Photo ›',
nextPageLinkText: 'Next ›',
prevPageLinkText: '‹ Prev',
enableHistory: false,
autoStart: false,
syncTransitions: true,
defaultTransitionDuration: 900,
onSlideChange: function(prevIndex, nextIndex) {
// 'this' refers to the gallery, which is an extension of $('#thumbs')
this.find('ul.thumbs').children()
.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
.eq(nextIndex).fadeTo('fast', 1.0);
},
onPageTransitionOut: function(callback) {
this.fadeTo('fast', 0.0, callback);
},
onPageTransitionIn: function() {
this.fadeTo('fast', 1.0);
}
});
});
CSS
div.content {
/* The display of content is enabled using jQuery so that the slideshow content won't display unless javascript is enabled. */
display: none;
float: right;
width: 630px;
}
div.content a, div.navigation a {
text-decoration: none;
color: #777;
}
div.content a:focus, div.content a:hover, div.content a:active {
text-decoration: underline;
}
div.controls {
margin: 15px 0 0 -80px;
height: 23px;
}
div.controls a {
padding: 5px;
color: black;
font-size: large;
}
div.ss-controls {
float: left;
}
div.nav-controls {
float: right;
margin-right: 110px;
}
div.slideshow-container {
position: relative;
clear: both;
width: 700px;
height: 700px; /* This should be set to be at least the height of the largest image in the slideshow */
}
div.loader {
position: absolute;
top: 0;
left: 0;
background-image: url('loader.gif');
background-repeat: no-repeat;
background-position: center;
width: 700px;
height: 701px; /* This should be set to be at least the height of the largest image in the slideshow */
}
div.slideshow span.image-wrapper {
display: block;
position: absolute;
top: 0;
left: 0;
}
div.slideshow a.advance-link {
display: block;
width: 700px;
height: 701px; /* This should be set to be at least the height of the largest image in the slideshow */
line-height: 701px; /* This should be set to be at least the height of the largest image in the slideshow */
text-align: center;
}
div.slideshow a.advance-link:hover, div.slideshow a.advance-link:active, div.slideshow a.advance-link:visited {
text-decoration: none;
}
div.slideshow img {
margin: 12px 0 0 0;
padding: 0;
border: 1px solid #ccc;
}
div.download {
float: right;
}
div.caption-container {
clear:left;
position: relative;
height: 75px;
margin: 0 0 0 -300px; /*ADDED STYLING */
}
span.image-caption {
display: block;
position: absolute;
width: 550px;
top: 0;
left: 0;
}
div.caption {
padding: 12px;
margin-left: -50px;
}
div.image-title {
font-weight: bold;
font-size: 1.4em;
margin: -102px 0 0 -25px; /*ADDED STYLING */
}
div.image-desc {
line-height: 1.3em;
padding-top: 12px;
}
#thumbs.navigation { /*ADDED STYLING */
margin-left: 30px;
}
div.navigation {
/* The navigation style is set using jQuery so that the javascript specific styles won't be applied unless javascript is enabled. */
}
ul.thumbs {
clear: both;
padding: 0;
}
ul.thumbs li {
float: left;
padding: 0;
margin: 10px 10px 5px 0;
list-style: none;
}
a.thumb {
padding: 2px;
display: block;
border: 1px solid #ccc;
}
ul.thumbs li.selected a.thumb {
background: #000;
}
a.thumb:focus {
outline: none;
}
ul.thumbs img {
border: none;
display: block;
}
div.pagination {
clear: both;
}
div.navigation div.top {
margin: 10px 10px 10px 0; /* ADDED STYLING */
height: 11px;
}
div.navigation div.bottom {
margin-top: -2px;
}
div.pagination a, div.pagination span.current, div.pagination span.ellipsis {
display: block;
float: left;
margin: 0 3px 6px 0;
padding: 0 5px 0 5px;
border: 2px solid #6e3b48;
border-radius: 5px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
-o-border-radius: 4px;
-ms-border-radius: 4px;
background: -moz-linear-gradient(19% 75% 90deg,#f0d967, #FDF0D1, #fff 100%);
background: -webkit-gradient(linear, 0% 25%, 50% 100%, from(#FFFFFF), to(#f0d967), color-stop(.3,#FDF0D1));
}
div.pagination a:hover {
cursor: pointer;
background: -moz-linear-gradient(19% 75% 90deg,#f0bf52, #f0bf52, #F5F5F5 100%);
background: -webkit-gradient(linear, 0% 25%, 50% 100%, from(#F5F5F5), to(#f0bf52), color-stop(.3,#F2E6C8));
}
div.pagination span.current {
font-weight: bold;
background-color: #000;
border-color: #000;
color: #6e3b48;
}
div.pagination span.ellipsis {
border: none;
padding: 5px 0 3px 2px;
}
有两个独立的文件,可以从顶部列出的网站获得:
jquery.galleriffic.js和js/jquery.opacityrollover.js
提前感谢您的帮助!