社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Jquery

jquery Mobile中如何编程更新滑块值

merlin • 7 年前 • 2035 次点击  

我在jquery 1.4.5中有一个定价滑杆,我想在加载时更新最小/最大值。不知何故,这根本不会改变数值。

//JSON的一部分:

"stats":{"price_min":5990,"price_max":26419}}

//滑块:

<label for="filter_price">Preis:</label>
<div data-role="rangeslider" id="filter_price" style="touch-action: none;">
    <input type="range" name="price_from" id="price_from" min="0" max="20000" step="100" value="<?=$filter_val['price_from']?>" data-popup-enabled="true">
    <input type="range" name="price_to" id="price_to" min="0" max="20000" step="100" value="<?=$filter_val['price_to']?>" data-popup-enabled="true">
</div>

enter image description here

//jquery:

if (obj.hasOwnProperty('stats')  && obj.stats && obj.stats.hasOwnProperty('price_min')) {
  $('#price_from').slider("option", "min", obj.stats.price_min);
  $('#price_to').slider("option", "min", obj.stats.price_min);  
}          
if (obj.hasOwnProperty('stats')  && obj.stats && obj.stats.hasOwnProperty('price_max')) {
  $('#price_from').slider("option", "max", obj.stats.price_max);  
  $('#price_to').slider("option", "max", obj.stats.price_max);  
}
$('#price_from').slider("refresh", true);
$('#price_to').slider("refresh", true);

在获得json最小/最大值后,我如何更改最小/最大值,即使HTML代码已经呈现并且有一个以HTML硬编码的回退最小/最大值?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/38939
文章 [ 1 ]  |  最新文章 7 年前