简体   繁体   English

如何在JS脚本中将宽度1024px转换为100%

[英]How to chage width 1024px to 100% in js script

<script>    
$(function(){
  var slider = new BeaverSlider({
    structure: {
      container: {
        id: "my-slider",
        width: '1024',
        height: 520,

      }
    },
    content: {
      images: [
        "images/slider/1.jpg",
        "images/slider/2.jpg",
        "images/slider/3.jpg",
        "images/slider/4.jpg",
        "images/slider/5.jpg",

        "images/slider/7.jpg",
        "images/slider/8.jpg",
      ]
    },
    animation: {
      effects: effectSets["slider: big set 2"],
      interval: 1000
    }
  });   
}); 
</script>

You can try with screen.width instead of 100% that you asked. 您可以尝试使用screen.width而不是您要求的100%。

...
   width: screen.width,
...

Just change: 只是改变:

    id: "my-slider", width: '1024'

to: 至:

    id: "my-slider", width: '100%'

??? ???

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何仅渲染内联 javascript 桌面设备(宽度&gt; 1024px) - How to render inline javascript only desktop device (width > 1024px) 如果屏幕大小小于1024px,请运行脚本 - Run script if screen size is less than 1024px 仅在屏幕大小大于1024px时执行JS吗? - Only execute JS if the screen size is more than 1024px? 仅当窗口宽度从桌面(&gt; 1024px)更改为移动(&lt;1025px)导航时,如何重新加载页面? - How to reload the page only when window width changes from desktop (>1024px) to mobile (<1025px) navigation? 如何将图像居中和调整大小为屏幕的 100% 宽度,但前提是 &lt;1024 像素 - How to center and size an image to be 100% width of the screen, but only if <1024 px 如何将图像的大小设置为屏幕的 100% 宽度,但前提是 &lt;1024 像素 - How to size an image to be 100% width of the screen, but only if <1024 px 如何使用jQuery区分桌面浏览器尺寸为1024px和平板电脑尺寸为1024px - How to distinguish between desktop browser dimension of 1024px from the tablet dimension 1024px using jquery 当屏幕宽度大于 1024px 时删除类(如果存在) - Remove class (if present) when screen width is greater than 1024px 屏幕低于1024像素时运行功能 - Run function when screen under 1024px 单击功能仅在1024px断点以上可用 - click function only available above 1024px breakpoint
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM