当您单击滑块并将其拖动一半或更多时,图像会发生变化。只有当鼠标点击被释放时,图像才会改变。有没有办法让改变发生,而不需要用户取消点击鼠标?
请参阅codependency文件:http://codepen.io/seantreanor/pen/zGapYW
$(function() {
$( "#slider" ).slider({
min: 0,
max: 100,
step: 1,
change: function(event, ui){
if(ui.value <=49){
$('#image').attr('src','http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg');
} else if(ui.value >=50) {
$('#image').attr('src','http://www.menucool.com/slider/jsImgSlider/images/image-slider-2.jpg');
};
}
});
});
用slide
代替change
。API文档