Gallerific: multiple galleries?

2.4k views Asked by At

I am working on a website that requires more than one jQuery gallery on the same page, and my go to working model Gallerific by Trent Foley. For a few sites, I have successfully utilized the thumbnail rollover effects and slideshow crossfades version with ease, but I am having a hard time implementing more than one gallerific gallery per page.

A few forums suggested using different id's for each gallery - I understand how that could work and played around with it for hours with no success. I'm wondering how all of it goes together to include the CSS & jQ.

Are there any working models out there of this being done successfully?

Here's the writeup...for those familiar with the plugin a lot of this you will have seen before:

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:              '&lsaquo; Previous Photo',
                nextLinkText:              'Next Photo &rsaquo;',
                nextPageLinkText:          'Next &rsaquo;',
                prevPageLinkText:          '&lsaquo; 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;
}

There are two independent files that go with this, which can be obtained from the website listed at the top:

jquery.galleriffic.js and js/jquery.opacityrollover.js

Thanks in advance for any help!

1

There are 1 answers

0
straubcreative On

Ok, so after some more digging I was able to find an answer through the Google Code forum for Gallerific.

It did actually boil down to renaming the each gallery's set of #ID's, wrapping the gallery in a class named "each-gallery" and then running it through a for loop

$(".each-gallery").each(function(i)

Download the HTML/JQ file on the Issue 76 Page by username "[email protected]", and copy over the CSS files from the Galleriffic home page. Then plug in your images and styles, works beautifully.