如何在js脚本中将宽度1024px更改为100%

时间:2014-06-24 05:25:00

标签: javascript

<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>

2 个答案:

答案 0 :(得分:1)

您可以尝试使用screen.width,而不是您提出的100%。

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

答案 1 :(得分:0)

只需改变:

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

为:

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

???