我知道这个问题已被提出,但我无法让解决方案奏效。我没有看到我的照片。图像路径是正确的。我做错了什么?
我已阅读此问题的解决方案:Changing slider handle image, Jquery slider with two arrows,和 changing jquery slider images。第三种解决方案似乎是最好的,但我不知道如何让它发挥作用。我已复制并粘贴,但我无法使其正常工作。这是完整的代码:
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-
ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js">
</script>
<script>
$(window).load(function(){
//Used for slider with two arrows - start
var firstHandleClass = 'first-handle';
var secondHandleClass = 'second-handle';
handle = $('#slider-range A.ui-slider-handle');
handle.removeClass('ui-corner-all');
handle.removeClass('ui-slider-handle');
handle.addClass('handle_');
handle.eq(0).addClass(firstHandleClass);
handle.eq(1).addClass(secondHandleClass);
});
</script>
<script>
$(document).ready(function() {
$("#slider").slider({
range: true,
values: [5,17]
});
});
</script>
<style type="text/css">
#slider { margin: 10px; }
.handle_ {
cursor: default;
position: absolute;
top: -0.3em;
z-index: 2;
}
.first-handle {
background: url("images/lefthandle.gif") no-repeat scroll 0 0 transparent;
border-style: none;
height: 36px;
margin-left: -9px;
position: absolute;
width: 21px;
}
.second-handle {
background: url("images/righthandle.gif") no-repeat scroll 0 0 transparent;
border-style: none;
height: 36px;
margin-right: -5px;
position: absolute;
width: 21px;
}
</style>
</head>
<body style="font-size:62.5%;">
<div id="slider"></div>
</body>
</html>
这是截图。图像未显示。任何人吗?
感谢。
答案 0 :(得分:1)
看起来选择器'#slider-range a.ui-slider-handle'
与任何元素都不匹配。尝试将其替换为'#slider a.ui-slider-handle'
并查看是否修复了它,如下所示:
handle = $('#slider A.ui-slider-handle');
handle.removeClass('ui-corner-all');
handle.removeClass('ui-slider-handle');
handle.addClass('handle_');
handle.eq(0).addClass(firstHandleClass);
handle.eq(1).addClass(secondHandleClass);