ようこそ! Geeklog Japan, Anonymous 2024/04/24 12:06 JST

UIkit v3を活用したサムネイルナビ付きスライドショー

  • 2019/01/25 03:19 JST
  • 投稿者:
  • 表示回数 9,667
Geeklog

メディアギャラリーのアルバムIDを指定して、UIkit v3を活用して、サムネイルのナビゲーション付きスライドショーを追加できます。

    [medialist:10 src:disp theme:uk-list limitcnt:10]
[medialist:10 src:tn theme:uk-list_inc limitcnt:10]

詳しくはUIkitサイトへ

Geeklog and MediaGallery download

静的ページなどに以下のように記述します。
アルバムID 10 を表示


<div uk-slideshow='animation: fade; autoplay: true '>
    <ul class="uk-slideshow-items">
            [medialist:10 src:disp theme:uk-list limitcnt:10]
    </ul>
    <a class="uk-position-center-left uk-position-small uk-hidden-hover" href="#"></a>
    <a class="uk-position-center-right uk-position-small uk-hidden-hover" href="#"></a>
    <div class="uk-margin-top uk-child-width-1-10 uk-grid-small" uk-grid>
        [medialist:10 src:tn theme:uk-list_inc limitcnt:10]
    </div>
</div>

※ limitcntは画像枚数制限

メディアギャラリープラグインのテンプレートをplugins/mediagallery/templates/medialist/下に2種類追加します。

テーマ:uk-list
uk-list/autotag_medialist.thtml


{# begin {templatelocation} #}
{medialist_col}
{# end {templatelocation} #}
uk-list:/autotag_medialist_col.thtml

{# begin {templatelocation} #}
      <li><img src="{filename}" alt="{media_title}" title="{media_title}" uk-cover{xhtml}></li>
{# end {templatelocation} #}

テーマ:uk-list_inc
uk-list_inc/autotag_medialist.thtml


{# begin {templatelocation} #}
<?php global $inc; $inc=0; ?>
{medialist_col}
{# end {templatelocation} #}
uk-list_inc:/autotag_medialist_col.thtml

{# begin {templatelocation} #}
      <div uk-slideshow-item="<?php global $inc; echo intval($inc); $inc++; ?>"><a href="#"><img src="{filename_tn}" alt="{media_title}" title="{media_title}" style="width:80px; height:auto"{xhtml}></a></div>
{# end {templatelocation} #}

Geeklog ivywe版をダウンロードして、/extended/以下の拡張ファイルのうち、mediagalleryをインストールして活用してください。