Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何更改Jssor图像滑块的尺寸而不丢失它';s的响应特性、图像纵横比等是否仅适用于iPhone设备?_Javascript_Jquery_Css_Iphone_Jssor - Fatal编程技术网

Javascript 如何更改Jssor图像滑块的尺寸而不丢失它';s的响应特性、图像纵横比等是否仅适用于iPhone设备?

Javascript 如何更改Jssor图像滑块的尺寸而不丢失它';s的响应特性、图像纵横比等是否仅适用于iPhone设备?,javascript,jquery,css,iphone,jssor,Javascript,Jquery,Css,Iphone,Jssor,我正在开发的网站本质上是响应性的,即网站设计会根据浏览设备进行调整。我使用了引导框架 我正在我的网站中使用Jssor JQuery图像滑块。它在所有设备和所有流行的知名浏览器上运行良好,非常适合我。我面临的唯一问题是,当在iPhone上观看时,Jssor滑块中滑动图像的大小应该更改为dimensions460 px*280 px。换句话说,Jssor图像滑块看起来应该比当前大小大一些。但在执行此操作时,滑块中显示的图像的纵横比应保持不变 此外,在iPhone上查看网站时,图像滑块应占据整个水平屏

我正在开发的网站本质上是响应性的,即网站设计会根据浏览设备进行调整。我使用了引导框架

我正在我的网站中使用Jssor JQuery图像滑块。它在所有设备和所有流行的知名浏览器上运行良好,非常适合我。我面临的唯一问题是,当在iPhone上观看时,Jssor滑块中滑动图像的大小应该更改为dimensions
460 px*280 px
。换句话说,Jssor图像滑块看起来应该比当前大小大一些。但在执行此操作时,滑块中显示的图像的纵横比应保持不变

此外,在iPhone上查看网站时,图像滑块应占据整个水平屏幕。也就是说,图像滑块周围不应出现任何空白。目前,滑块两侧都出现了两个垂直空白条

最初,当在PC或笔记本电脑的浏览器上查看网站时,滑块图像的分辨率为
940 px*370 px
,并根据浏览设备的大小进行自动调整

上述尺寸变化应仅在iPhone上发生,而不应在任何其他设备上发生。在其他设备上,它的工作绝对完美。在这个过程中,图像的纵横比也不应该受到干扰

为了便于参考,我在下面列出了滑块的HTML代码和jQuery代码。包括了所有必要的库文件

HTML代码:

<div id="slider1_container" style="position: relative; top: 0px; left: 0px; width: 940px; height: 370px; overflow: hidden; ">

      <div u="loading" style="position: absolute; top: 0px; left: 0px;">
        <div style="filter: alpha(opacity=70); opacity:0.7; position: absolute; display: block; background-color: #000000; top: 0px; left: 0px;width: 100%;height:100%;">
        </div>
        <div style="position: absolute; display: block; background: url(img/loading.gif) no-repeat center center; top: 0px; left: 0px;width: 100%;height:100%;">
        </div>
      </div>     

      <div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 940px; height: 370px; overflow: hidden;">
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Bud_Light_Lime_1413041685.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute; left:350px; bottom: 40px;  width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Finlandia_1413041875.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute; left:350px; bottom: 40px; width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Three_Olives_1413042332.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute;left:350px; bottom: 40px;  width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Avalon_1413041406.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute; left:350px; bottom: 40px; width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Brancott_1413042551.JPG" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute;left:350px; bottom: 40px;  width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
      </div>        
      <div u="navigator" class="jssorb05" style="position: absolute; bottom: 16px; right: 6px;">           
        <div u="prototype" style="POSITION: absolute; WIDTH: 16px; HEIGHT: 16px;"></div>
      </div>        
      <style>
      .jssorb05 div, .jssorb05 div:hover, .jssorb05 .av {
        background: url(img/b05.png) no-repeat;
        overflow: hidden;
        cursor: pointer;
      }

      .jssorb05 div {
        background-position: -7px -7px;
      }

      .jssorb05 div:hover, .jssorb05 .av:hover {
        background-position: -37px -7px;
      }

      .jssorb05 .av {
        background-position: -67px -7px;
      }

      .jssorb05 .dn, .jssorb05 .dn:hover {
        background-position: -97px -7px;
      }
      .jssora12l, .jssora12r, .jssora12ldn, .jssora12rdn {
        position: absolute;
        cursor: pointer;
        display: block;
        background: url(img/a12.png) no-repeat;
        overflow: hidden;
      }

      .jssora12l {
        background-position: -16px -37px;
      }

      .jssora12r {
        background-position: -75px -37px;
      }

      .jssora12l:hover {
        background-position: -136px -37px;
      }

      .jssora12r:hover {
        background-position: -195px -37px;
      }

      .jssora12ldn {
        background-position: -256px -37px;
      }

      .jssora12rdn {
        background-position: -315px -37px;
      }
      .captionOrange, .captionBlack {
        color: #fff;
        font-size: 20px;
        line-height: 30px;
        text-align: center;
        border-radius: 4px;
      }
      .captionOrange {
        background: #EB5100;
        background-color: rgba(235, 81, 0, 0.6);
      }
      .captionBlack {
        font-size:16px;
        background: #000;
        background-color: rgba(0, 0, 0, 0.4);
      }
      a.captionOrange, A.captionOrange:active, A.captionOrange:visited {
        color: #ffffff;
        text-decoration: none;
      }
      a.captionOrange:hover {
        color: #eb5100;
        text-decoration: underline;
        background-color: #eeeeee;
        background-color: rgba(238, 238, 238, 0.7);
      }
      .bricon {
        background: url(img/browser-icons.png);
      }
    </style>       
    <span u="arrowleft" class="jssora12l" style="width: 30px; height: 46px; top: 123px; left: 0px;"></span>
    <span u="arrowright" class="jssora12r" style="width: 30px; height: 46px; top: 123px; right: 0px"></span>        
      <a style="display: none" href="http://www.jssor.com">javascript</a>
    </div>
<script>
    jQuery(document).ready(function ($) {

      var _SlideshowTransitions = [{ $Duration: 1200, $Opacity: 2 }];

      var options = {
        $AutoPlay: 1,                                    
        $AutoPlaySteps: 1,                                  
        $Idle: 3000,                            
        $PauseOnHover: 1,                               
        $ArrowKeyNavigation: true,                          
        $SlideDuration: 500,                                
        $MinDragOffsetToSlide: 20,                          
        $SlideSpacing: 0,                                   
        $Cols: 1,                                  
        $Align: 0,                                
        $UISearchMode: 1,                                   
        $PlayOrientation: 1,                                
        $DragOrientation: 3,                                

        $SlideshowOptions: {                                
          $Class: $JssorSlideshowRunner$,                 
          $Transitions: _SlideshowTransitions,            
          $TransitionsOrder: 1,                           
          $ShowLink: true                                    
        },

        $BulletNavigatorOptions: {                                
          $Class: $JssorBulletNavigator$,                       
          $ChanceToShow: 2,                               
          $Steps: 1,                                      
          $Rows: 1,                                      
          $SpacingX: 10,                                   
          $SpacingY: 10,                                   
          $Orientation: 1                                 
        },

        $ArrowNavigatorOptions: {
          $Class: $JssorArrowNavigator$,              
          $ChanceToShow: 2,                               
          $Steps: 1                                       
        }
      };
      var jssor_slider1 = new $JssorSlider$("slider1_container", options);

      function ScaleSlider() {
        var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;
        if (parentWidth)
          jssor_slider1.$ScaleWidth(Math.min(parentWidth, 940));
        else
          window.setTimeout(ScaleSlider, 30);
        }

        ScaleSlider();

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

幻灯片过渡孪晶
幻灯片过渡孪晶
幻灯片过渡孪晶
幻灯片过渡孪晶
幻灯片过渡孪晶
.jssorb05 div、.jssorb05 div:hover、.jssorb05.av{
背景:url(img/b05.png)不重复;
溢出:隐藏;
光标:指针;
}
.JS05分区{
背景位置:-7px-7px;
}
.jssorb05 div:hover,.jssorb05.av:hover{
背景位置:-37px-7px;
}
.js05.av{
背景位置:-67px-7px;
}
.jssorb05.dn、.jssorb05.dn:悬停{
背景位置:-97px-7px;
}
.jssora12l、.jssora12r、.jssora12ldn、.jssora12rdn{
位置:绝对位置;
光标:指针;
显示:块;
背景:url(img/a12.png)不重复;
溢出:隐藏;
}
.jssora12l{
背景位置:-16px-37px;
}
.jssora12r{
背景位置:-75px-37px;
}
.jssora12l:悬停{
背景位置:-136px-37px;
}
.jssora12r:悬停{
背景位置:-195px-37px;
}
.jssora12ldn{
背景位置:-256px-37px;
}
.jssora12rdn{
背景位置:-315px-37px;
}
.captionRange、.captionBlack{
颜色:#fff;
字体大小:20px;
线高:30px;
文本对齐:居中;
边界半径:4px;
}
.字幕范围{
背景:#EB5100;
背景色:rgba(235,81,0,0.6);
}
标题:黑色{
字体大小:16px;
背景:#000;
背景色:rgba(0,0,0,0.4);
}
a、 CaptionRange,a.CaptionRange:活动,a.CaptionRange:已访问{
颜色:#ffffff;
文字装饰:无;
}
a、 字幕范围:悬停{
颜色:#eb5100;
文字装饰:下划线;
背景色:#eeeeee;
背景色:rgba(2382382380.7);
}
布里森先生{
背景:url(img/browser-icons.png);
}
jQuery代码:

<div id="slider1_container" style="position: relative; top: 0px; left: 0px; width: 940px; height: 370px; overflow: hidden; ">

      <div u="loading" style="position: absolute; top: 0px; left: 0px;">
        <div style="filter: alpha(opacity=70); opacity:0.7; position: absolute; display: block; background-color: #000000; top: 0px; left: 0px;width: 100%;height:100%;">
        </div>
        <div style="position: absolute; display: block; background: url(img/loading.gif) no-repeat center center; top: 0px; left: 0px;width: 100%;height:100%;">
        </div>
      </div>     

      <div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 940px; height: 370px; overflow: hidden;">
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Bud_Light_Lime_1413041685.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute; left:350px; bottom: 40px;  width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Finlandia_1413041875.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute; left:350px; bottom: 40px; width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Three_Olives_1413042332.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute;left:350px; bottom: 40px;  width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Avalon_1413041406.jpg" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute; left:350px; bottom: 40px; width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
        <div>
          <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Brancott_1413042551.JPG" />
          <div u=caption t="*" class="captionOrange"  style="position:absolute;left:350px; bottom: 40px;  width:300px; height:30px;"> 
            slideshow transition twins
          </div>
        </div>
      </div>        
      <div u="navigator" class="jssorb05" style="position: absolute; bottom: 16px; right: 6px;">           
        <div u="prototype" style="POSITION: absolute; WIDTH: 16px; HEIGHT: 16px;"></div>
      </div>        
      <style>
      .jssorb05 div, .jssorb05 div:hover, .jssorb05 .av {
        background: url(img/b05.png) no-repeat;
        overflow: hidden;
        cursor: pointer;
      }

      .jssorb05 div {
        background-position: -7px -7px;
      }

      .jssorb05 div:hover, .jssorb05 .av:hover {
        background-position: -37px -7px;
      }

      .jssorb05 .av {
        background-position: -67px -7px;
      }

      .jssorb05 .dn, .jssorb05 .dn:hover {
        background-position: -97px -7px;
      }
      .jssora12l, .jssora12r, .jssora12ldn, .jssora12rdn {
        position: absolute;
        cursor: pointer;
        display: block;
        background: url(img/a12.png) no-repeat;
        overflow: hidden;
      }

      .jssora12l {
        background-position: -16px -37px;
      }

      .jssora12r {
        background-position: -75px -37px;
      }

      .jssora12l:hover {
        background-position: -136px -37px;
      }

      .jssora12r:hover {
        background-position: -195px -37px;
      }

      .jssora12ldn {
        background-position: -256px -37px;
      }

      .jssora12rdn {
        background-position: -315px -37px;
      }
      .captionOrange, .captionBlack {
        color: #fff;
        font-size: 20px;
        line-height: 30px;
        text-align: center;
        border-radius: 4px;
      }
      .captionOrange {
        background: #EB5100;
        background-color: rgba(235, 81, 0, 0.6);
      }
      .captionBlack {
        font-size:16px;
        background: #000;
        background-color: rgba(0, 0, 0, 0.4);
      }
      a.captionOrange, A.captionOrange:active, A.captionOrange:visited {
        color: #ffffff;
        text-decoration: none;
      }
      a.captionOrange:hover {
        color: #eb5100;
        text-decoration: underline;
        background-color: #eeeeee;
        background-color: rgba(238, 238, 238, 0.7);
      }
      .bricon {
        background: url(img/browser-icons.png);
      }
    </style>       
    <span u="arrowleft" class="jssora12l" style="width: 30px; height: 46px; top: 123px; left: 0px;"></span>
    <span u="arrowright" class="jssora12r" style="width: 30px; height: 46px; top: 123px; right: 0px"></span>        
      <a style="display: none" href="http://www.jssor.com">javascript</a>
    </div>
<script>
    jQuery(document).ready(function ($) {

      var _SlideshowTransitions = [{ $Duration: 1200, $Opacity: 2 }];

      var options = {
        $AutoPlay: 1,                                    
        $AutoPlaySteps: 1,                                  
        $Idle: 3000,                            
        $PauseOnHover: 1,                               
        $ArrowKeyNavigation: true,                          
        $SlideDuration: 500,                                
        $MinDragOffsetToSlide: 20,                          
        $SlideSpacing: 0,                                   
        $Cols: 1,                                  
        $Align: 0,                                
        $UISearchMode: 1,                                   
        $PlayOrientation: 1,                                
        $DragOrientation: 3,                                

        $SlideshowOptions: {                                
          $Class: $JssorSlideshowRunner$,                 
          $Transitions: _SlideshowTransitions,            
          $TransitionsOrder: 1,                           
          $ShowLink: true                                    
        },

        $BulletNavigatorOptions: {                                
          $Class: $JssorBulletNavigator$,                       
          $ChanceToShow: 2,                               
          $Steps: 1,                                      
          $Rows: 1,                                      
          $SpacingX: 10,                                   
          $SpacingY: 10,                                   
          $Orientation: 1                                 
        },

        $ArrowNavigatorOptions: {
          $Class: $JssorArrowNavigator$,              
          $ChanceToShow: 2,                               
          $Steps: 1                                       
        }
      };
      var jssor_slider1 = new $JssorSlider$("slider1_container", options);

      function ScaleSlider() {
        var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;
        if (parentWidth)
          jssor_slider1.$ScaleWidth(Math.min(parentWidth, 940));
        else
          window.setTimeout(ScaleSlider, 30);
        }

        ScaleSlider();

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

jQuery(文档).ready(函数($){
var_SlideshowTransitions=[{$Duration:1200,$Opacity:2}];
变量选项={
$AutoPlay:1,
$AutoPlay步骤:1,
$Idle:3000,
$PauseOnHover:1,
$ArrowKeyNavigation:true,
教育费:500美元,
$MindragOffsetoslide:20,
$SlideSpacing:0,
$Cols:1,
$Align:0,
$UISearchMode:1,
$Play方向:1,
$DRAGORIENTION:3,
$SlideshowOptions:{
$Class:$JssorSlideshowRunner$,
$Transitions:_幻灯片放映Transitions,
$Transitions订单:1,
$ShowLink:正确
},
$BulletNavigatorOptions:{
$Class:$JssorBulletNavigator$,
$ChanceToShow:2,
$Steps:1,
$Rows:1,
$SpacingX:10,
$SpacingY:10,
//Your website
jQuery(document).ready(function ($) { 
   //...
   function ScaleSliderDevices() {
             var bodyWidth = DEVICE.Screen.width();
             if (DEVICE.Screen.osDimVariation()) {
                 bodyWidth = DEVICE.Screen.width() + osWidthOffset();
             }
              jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 940));
         };

    //...
    if (DEVICE.mobile())
    {
        $(window).bind('resize', ScaleSliderDevices);
    }

    //as the resize event may not fire at the beginning sometimes, please scale slider manually after document load
    ScaleSliderDevices();
}