如何阻止导致 UI Slider 消失的全局 JQuery Effect
我使用以下 JQuery UI 滑块脚本来输入值:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery( "#slider-range-min" ).slider({
range: "min",
value: 5,
min: 1,
step: 5,
max: 60,
slide: function( event, ui ) {
jQuery( "#amount" ).val( ui.value );
}
});
jQuery( "#amount" ).val( jQuery( "#slider-range-min" ).slider( "value" ) );
</script>
<div style="width:100%;clear:both;margin-top:10px;"></div>
<div id="slider-range-min"></div>
每当单击或滑动滑块上的旋钮时,它就会隐藏或向上滑出站点。我无法确定到底是哪种效果导致滑块消失。这是一个问题,因为如果用户最初设置了错误的值,则无法纠正它,因为滑块已经消失。有没有办法阻止滑块受到其他全局效果的影响。我再次不确定导致此问题的确切效果(隐藏、slideUP 等)
I'm using the following JQuery UI slider script to input values:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery( "#slider-range-min" ).slider({
range: "min",
value: 5,
min: 1,
step: 5,
max: 60,
slide: function( event, ui ) {
jQuery( "#amount" ).val( ui.value );
}
});
jQuery( "#amount" ).val( jQuery( "#slider-range-min" ).slider( "value" ) );
</script>
<div style="width:100%;clear:both;margin-top:10px;"></div>
<div id="slider-range-min"></div>
Whenever the knob on the slid is clicked or slid, it is hidden or slides up out of site. I have not been able to determine which effect exactly is causing the slider to disappear. This is a problem, because if a user happens to initially set the wrong value, the cannot correct it because the slider has disappeared. Is there a way to block the slider from other globale effects. Again I am not sure which exact effect is causing this (hide,slideUP,etc)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在 JQueryUI 中使用范围滑块,则需要使用
.slider('values')
而不是.slider('value')
。根据文档:
If you are using a ranged slider in JQueryUI, you need to use
.slider('values')
instead of.slider('value')
.Per the docs:
您是否可能遇到 MooTools 和 jQuery 库冲突 (1,2)?
一种解决方法是在应用 jQuery UI 滑块之前删除每个 MooTools 滑动方法,如下所示:
Could you possibly have a MooTools and jQuery library collision (1, 2)?
One workaround is to remove each MooTools slide method before applying the jQuery UI slider as such: