In JSSOR, how to access the current caption via Ja

2019-02-18 16:50发布

I would like to pass a value from a slide out of JSSOR to other parts of the DOM.

Markup:

  <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);
   });

The custom JSSOR Event, EVT_PARK, works fine. But what's missing is how to get the caption of the current slide and put it into the variable currentCaption. How to do that?

And if so, where could I have found that out on my own?

标签: jssor
1条回答
地球回转人心会变
2楼-- · 2019-02-18 17:32

Please have a full test of following code,

  <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());
   });
查看更多
登录 后发表回答