2

英语不是我的第一语言,很抱歉我的错误;)

我想将所有缩略图放在一个块中,而不是在滑块示例中(加号是图像)

不是:

< +++++++++ >(带导航按钮的滑块)

我想要:

+++++++++
+++++++++
+++

我用 css 实现了这一点(white-space: nowrap;在 中禁用div.fotorama__nav fotorama__nav--thumbs fotorama__shadows--right),问题是许多图像默认不显示,我该如何实现?

我或多或少地得到了这个(“+”是图像,“o”是卸载图像)

+++++++++ +
ooooooooooo

有什么办法可以用 fotorama 实现我的 porpouse 吗?非常感谢你

4

2 回答 2

2

您必须使用 Fotorama API、事件和方法(仍未记录):

<div class="thumbs">
  <a href="1.jpg"><img src="1-thumb.jpg"></a>
  <a href="2.jpg"><img src="2-thumb.jpg"></a>
</div>

<script>
$('.thumbs').each(function () {
  $('a', this).each(function () {
    var $a = $(this);
    // set ids, will use them later
    $a.attr({id: $a.attr('href').replace(/[\/\.-]/g, '')});
  });

  var $thumbs = $(this),
      $fotorama = $thumbs.clone();

  $fotorama
      .on('fotorama:show', function (e, fotorama) {
        // pick the active thumb by id
        $('#' + fotorama.activeFrame.id)
            .addClass('active')
            .siblings()
            .removeClass('active');
      })
      .addClass('fotorama')
      .removeClass('thumbs')
      .insertBefore(this)
      .fotorama({nav: false, width: '100%', maxHeight: 400, ratio: 3/2});

  // get access to the API
  var fotorama = $fotorama.data('fotorama');

  $thumbs.on('click', 'a', function (e) {
    e.preventDefault();
    // show frame by id
    fotorama.show(this.id);
  });
});
</script>

小提琴:http: //jsfiddle.net/artpolikarpov/tnWLv/embedded/result,html,css,js/

于 2013-11-08T19:29:35.940 回答
0

使 data-thumbwidth="1px" 和 css .fotorama__nav__frame--thumb {width:100px!importnant} (例如)

或者

data-navwidth="20000px" 并使用您的 css 更正

于 2020-04-21T12:36:46.770 回答