我有一个工作正常的 jquery 滑块,但是当我通过 ajax 目标 div 加载它时,它看起来不可见。我的 ajax 和滑块脚本如下;
AJAX
function showSearchOptions(search, distance) {
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("searchoptions").innerHTML = '';
document.getElementById("searchoptions").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "search.php?ajax=yes&method=options&search=" + search + "&distance=" + distance, true);
xmlhttp.send();
}
滑块
$(document).ready(function () {
$("#slider2").slider({
range: true,
min: $minprice,
max: $maxprice,
values: [$minprice, $maxprice],
slide: function (event, ui) {
$("#amount").val($("#slider2").slider("values", 0));
$("#amount2").val($("#slider2").slider("values", 1));
$("#slidervalues").html("£" + $("#slider2").slider("values", 0) + " - £" + $("#slider2").slider("values", 1));
}
});
$("#amount").val($("#slider2").slider("values", 0));
$("#amount2").val($("#slider2").slider("values", 1));
$("#slidervalues").html("£" + $("#slider2").slider("values", 0) + " - £" + $("#slider2").slider("values", 1));
});
提前致谢。