2013-03-12 3 views
0

Я работаю над веб-сайтом, который требует более одной галереи jQuery на той же странице, и мой переход к рабочей модели Gallerific by Trent Foley. Для нескольких сайтов я успешно использовал thumbnail rollover effects and slideshow crossfades version с легкостью, но мне нелегко реализовать более чем одну галерею на странице.Условно-бесплатная: несколько галерей?

Несколько форумов, предлагающих использовать разные идентификаторы для каждой галереи - я понимаю, как это может работать и работать с ним в течение нескольких часов без успеха. Мне интересно, как все это объединяется, чтобы включить 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.js и JS/jquery.opacityrollover.js

Заранее благодарим за любую помощь!

ответ

1

Итак, после некоторого дополнительного рытья я смог найти ответ через Google Code forum for Gallerific.

Это на самом деле сводится к переименованию набора каждой галереи из # идентификаторов, обертывание галереи в классе под названием «каждая-галерея», а затем запустить его через цикл

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

Скачать HTML/JQ на Issue 76 Page по имени пользователя «hiphop ... @ gmail.com» и скопируйте файлы CSS с домашней страницы Galleriffic. Затем подключите свои изображения и стили, прекрасно работает.

Смежные вопросы