I think there is a problem with your markup (the width of the element of the initial value?) Or not start it after the elements are ready. In any case, here is a complete working sample:
<html>
<head>
<title>Test</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css" rel="stylesheet" />
<style type="text/css">
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript">
function SliderSetup()
{
$("#slider").slider({
value:0,
min: -10,
max: 10,
step: 2,
animate:false,
slide: function(event, ui) {
setTimeout(showVal, 10);
}
});
$("#slider").slider("value", 0);
showVal();
}
function showVal() {
var slider = $('.ui-slider-handle:first');
var position = slider.offset();
var value = $('#slider').slider('value');
var val = $('#value1');
val.text(value).css({'left':position.left + ((slider.width() - val.width()) /2), 'top':position.top -20 });
}
$(function(){
SliderSetup();
});
</script>
</head>
<body>
<br/><br/><br/>
<div id="value1" style="position: absolute"></div>
<div id="slider"></div>
</body>
</html>
, , . css - , , , , . value, css, , , :
#value1 { border: solid 1px red; }