How does one get a slider working with 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 } );
Let me know if you need more code. 开发者_运维知识库What am I doing wrong?
Looks like you just need to add some jQueryUI styles to it.
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/base/jquery-ui.css" type="text/css" media="all" />
Also, you don't need to have <div class='ui-slider-handle'></div>
inside the div
, it's handled by jQueryUI.
精彩评论