【发布时间】:2014-05-29 16:14:53
【问题描述】:
我的页面上有一个引导滑块。我不知道如何更改此代码,即 page.php 在拖动滑块时不会持续加载,但只有在我停止拖动它时(在所需的时间段之后)。可能我必须使用 slideStop 事件,但不知道如何。
<script type="text/javascript">
$(document).ready(function() {
var intSeconds = 1;
var refreshId;
function sTimeout() {
$("#mydiv").load("page.php"); // load content
refreshId = setTimeout(function() { // saving the timeout
sTimeout();
}, intSeconds *3000);
}
sTimeout();
$.ajaxSetup({cache: false});
// The slider
$("#ex1").slider({
min : 1, // minimum value
max : 20, // maximum value
step : 1,
value : intSeconds, // copy current value
formater: function(value) { // option to format the values before they are sent to the tooltip
clearTimeout(refreshId); // clear it
intSeconds = value; // update value
sTimeout(); // restart it
return value*3 + ' s';
}
});
});
</script>
【问题讨论】:
标签: javascript jquery slider