【问题标题】:cannot get jQuery slider to work无法让 jQuery 滑块工作
【发布时间】:2011-03-14 01:53:53
【问题描述】:

如何让滑块与 jQuery 一起使用。

HTML:

<head>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
</head>
<body>
    <div id='example1' class='ui-slider-1' style="margin: 40px;">
        <div class='ui-slider-handle'></div>    
</div>  

</body>

CSS:

.ui-slider-handle {
    border:1px solid silver;
    height:10px;width:10px;
    background-color:black;
}

#example1 {
    width:1050px;
    background-color:white;
   border:1px solid black;
}    

jQuery:

$('#example1').slider( { minValue: -100, maxValue: 100 } );

如果您需要更多代码,请告诉我。我做错了什么?

【问题讨论】:

    标签: jquery html css slider


    【解决方案1】:

    看起来你只需要向它添加一些 jQueryUI 样式。

    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/base/jquery-ui.css" type="text/css" media="all" />
    

    另外,您不需要在div 中包含&lt;div class='ui-slider-handle'&gt;&lt;/div&gt;,它由jQueryUI 处理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多