3

我想将一个值从 JSSOR 的幻灯片传递到 DOM 的其他部分。

标记:

  <div class="slide">
    <img data-u="image" src="bilder/bild2.jpg" />
    <div class="caption" data-u="caption" ><p>Caption text</p></div>
  </div>

JS:

   jssor_slider1.$On($JssorSlider$.$EVT_PARK,function(slideIndex,fromIndex){
     $(".outer-caption").text(currentCaption);
   });

自定义 JSSOR 事件 EVT_PARK 工作正常。但是缺少的是如何获取当前幻灯片的标题并将其放入变量 currentCaption 中。怎么做?

如果是这样,我在哪里可以自己发现呢?

4

1 回答 1

2

请对以下代码进行全面测试,

  <div class="slide">
    <img data-u="image" src="bilder/bild2.jpg" />
    <div class="caption" data-u="caption" id="caption-slide-0"><p>Slide 0 Caption</p></div>
  </div>

   jssor_slider1.$On($JssorSlider$.$EVT_PARK,function(slideIndex,fromIndex){
     $("#outer-caption").text($("#caption-slide-" + slideIndex).text());
   });
于 2014-05-31T16:00:41.260 回答