增加滑块Jssor的宽度

时间:2015-12-11 07:15:56

标签: javascript jquery slider jssor

我刚开始使用jssor slider.I知道有很多与jssor滑块相关的例子。我想根据需要定制滑块。我只是用jssor从头开始创建简单的滑块。我想增加slider的宽度和高度。这是我的代码:

<html>
<head>
  <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="js/jssor.slider.mini.js"></script>
<script>
jQuery(document).ready(function ($) {
        var options = { $AutoPlay: true};
        var jssor_slider1 = new $JssorSlider$('slider1_container', options);
});

</script>
</head>
<body>
<div id="slider1_container" style="position: relative; top: 0px; left: 0px; width: 600px; height: 300px;">
                        <!-- Slides Container -->
    <div u="slides" style="cursor: move; position: absolute; overflow: hidden; left: 0px; top: 0px; width: 600px; height: 300px;">
        <div><img u="image" src="img/01.jpg" /></div>
        <div><img u="image" src="img/02.jpg" /></div>
    </div>
</div>
</body>

</html>

1 个答案:

答案 0 :(得分:0)

检查此代码

 function ScaleSlider() {
                var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;
                if (refSize) {
                    refSize = Math.min(refSize,1200);
                    jssor_1_slider.$ScaleWidth(refSize);
                }
                else {
                    window.setTimeout(ScaleSlider, 30);
                }
            }
            ScaleSlider();
            $Jssor$.$AddEvent(window, "load", ScaleSlider);
            $Jssor$.$AddEvent(window, "resize", $Jssor$.$WindowResizeFilter(window, ScaleSlider));
            $Jssor$.$AddEvent(window, "orientationchange", ScaleSlider);
            //responsive code end
        };