2014-10-30 53 views

回答

0

以下代碼是在窗口調整大小時縮放滑塊。

 //responsive code begin 
     //you can remove responsive code if you don't want the slider scales while window resizes 
     function ScaleSlider() { 
      var bodyWidth = document.body.clientWidth; 
      if (bodyWidth) 
       jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 980)); 
      else 
       window.setTimeout(ScaleSlider, 30); 
     } 

     ScaleSlider(); 

     if (!navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|IEMobile)/)) { 
      $(window).bind('resize', ScaleSlider); 
     } 


     //if (navigator.userAgent.match(/(iPhone|iPod|iPad)/)) { 
     // $(window).bind("orientationchange", ScaleSlider); 
     //} 
     //responsive code end 

請稍作更改以同時調整兩個滑塊的大小。

 function ScaleSlider() { 
      var bodyWidth = document.body.clientWidth; 
      if (bodyWidth) { 
       jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 980)); 
       jssor_slider2.$ScaleWidth(Math.min(bodyWidth, 980)); 
      } 
      else 
       window.setTimeout(ScaleSlider, 30); 
     }