2016-04-25 4 views
1

画像を表示するJssorスライダがあり、右側のスライダに残っている画像の数と画像の総数が表示されます。左側。添付のスクリーンショットを例として参照してください。 Example image sliderJssorスライダの利用可能な画像と残りの画像の数を取得する

スライダーオプション:画像を残り

tot_img=$('img[data-u="image"]').length; 

:取得するjssorのイベント$EVT_PARKを使用

< script type = "text/javascript" > 
    jQuery(document).ready(function($) { 

    var jssor_1_options = { 
     $AutoPlay: false, 
     $AutoPlaySteps: 4, 
     $SlideDuration: 160, 
     $SlideWidth: 200, 
     $SlideSpacing: 3, 
     $Cols: 4, 
     $Captions: true, 
     $ArrowNavigatorOptions: { 
     $Class: $JssorArrowNavigator$, 
     $Steps: 1 
     }, 
     $BulletNavigatorOptions: { 
     $Class: $JssorBulletNavigator$, 
     $SpacingX: 1, 
     $SpacingY: 1 
     } 
    }; 

    var jssor_1_slider = new $JssorSlider$("jssor_1", jssor_1_options); 
< /script> 

HTML:あなたはこのように取得画像の

<div class="imgSlider"> 
    <div id="jssor_1" style="position: relative; margin: 0 auto; top: 0px; left: -30px; width: 1000px ! important; height: 150px; overflow: hidden; visibility: hidden;"> 


     <div style="display: none;"> 
     <img data-u="image" src="Content/img/logo1.jpg" /> 
     <div class="caption" style="position: fixed; top: 90px; left: 80px; width: auto; height: 0px; font-weight: bold; text-align:center; font-size: 15px;" u="caption"> 
      <p>Report1</p> 
     </div> 
     </div> 
     <div style=": none;"> 
     <img data-u="image" src="Content/img/logo2.jpg" /> 
     <div class="caption" style="position: fixed; top: 90px; left: 80px; width: auto; height: 0px; font-weight: bold;text-align:center; font-size: 15px;" u="caption"> 
      <p>Report2</p> 
     </div> 
     </div> 

     <!--more slides--> 

    </div> 
</div> 

答えて

1

合計スライドの現在のインデックス。残りの画像は、ちょうど総画像から減算されます。jssor APIの

tot_img=$('img[data-u="image"]').length; 
jssor_1_slider.$On($JssorSlider$.$EVT_PARK,function(slideIndex, fromIndex){ 
    console.log('remaining:'+ parseInt(tot_img-slideIndex-1)) 
}); 

詳細here

フィドル:私は上記のコードを使用してみましたが、結果を取得できませんでしたhere

+0

。私のコードであなたが提供しているコード行をどこで正確に使うべきか教えてください。ありがとう – Jarvis

+0

私はこれをスライダでテストしました。スライダを宣言する行のすぐ下にコードを挿入します。var jssor_1_slider = new $ JssorSlider $( "jssor_1"、jssor_1_options); – Vickel

+0

Vickel、この手伝いできますか?http://stackoverflow.com/questions/37940201/jssor-slider-not-working-for-devexpress-listboxes – Jarvis

関連する問題