2013-03-12 86 views
0

我正在一個網站上工作,需要在同一頁面上有多個jQuery畫廊,並且我的工作模式爲Gallerific by Trent Foley。對於一些網站,我已經很容易成功地使用了thumbnail rollover effects and slideshow crossfades version,但我很難實現每頁以上的多個藝術館。Gallerific:多個畫廊?

幾個論壇建議爲每個畫廊使用不同的編號 - 我理解這可以如何工作,並在幾個小時內沒有成功地玩過它。我想知道如何將它們放在一起以包含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:    '&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; 
} 

有兩個獨立的文件,與此去,可以從頂部列出的網站獲得:

jquery.galleriffic.jsJS/jquery.opacityrollover.js

在此先感謝您的幫助!

回答

1

好吧,等一些挖掘後,我能通過Google Code forum for Gallerific找到答案。

它實際上確實可以歸結爲重命名每家畫廊的一套#ID的,包裹在一個名爲「每個畫廊」一流的畫廊,然後運行它通過一個for循環

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

下載HTML /使用用戶名「hiphop ... @ gmail.com」在Issue 76 Page上輸入JQ文件,然後複製Galleriffic主頁中的CSS文件。然後插入你的圖像和樣式,精美的作品。