0

私は、同じページに複数の jQuery ギャラリーを必要とする Web サイトに取り組んでおり、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:              '&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;
}

これに付随する 2 つの独立したファイルがあり、上部にリストされている Web サイトから入手できます。

jquery.galleriffic.jsおよびjs/jquery.opacityrollover.js

助けてくれてありがとう!

4

1 に答える 1

1

わかりました。さらに掘り下げた後、Gallerificの Google Code フォーラムで回答を見つけることができました。

実際には、各ギャラリーの #ID のセットの名前を変更し、ギャラリーを「each-gallery」という名前のクラスにラップしてから、for ループを実行することになりました。

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

Issue 76 ページでユーザー名「hiphop...@gmail.com」でHTML/JQ ファイルをダウンロードし、 Gallerifficホームページから CSS ファイルをコピーします。次に、画像とスタイルをプラグインすると、美しく機能します。

于 2013-03-12T23:49:41.633 に答える