我正在基于jQuery移动的订单形式,到现在为止我一直在使用http://demos.jquerymobile.com/1.4.2/forms/指导(我不是很好的JS,但我学习)。到目前为止,我有一个滑块,一个选择(是/否)和结果计算的文本框。剩下的就是取出滑块值并将其乘以yes或no值并将其显示在文本框中。例如,如果设置为yes,则乘以8;如果设置为no,则乘以10。jQuery Mobile的滑块计算
我已经看到了一些如何通过将DIV转换为基本滑块来实现此目的的示例,但我还没有想出使用jQuery移动滑块来实现这一点的方法。我仍然试图弄清楚,但我会欣赏任何想法。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="css/jquery.mobile-1.2.0.css" />
<link rel="stylesheet" href="css/jqm-docs.css"/>
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/jqm-docs.js"></script>
<script src="js/jquery.mobile-1.2.0.js"></script>
<style type="text/css">
body{background:none transparent}
</style>
</head>
<body>
<form action="redirector.php" method="POST" data-ajax="false" class="ui-body ui-body-a ui-corner-all">
<div data-role="fieldcontain"><input type="range" name="slots" id="slots" value="16" min="8" max="18" data-theme="a" data-track-theme="b" /></div>
<style type="text/css" media="screen">
.containing-element .ui-slider-switch { width: 9em; }
</style>
<div class="containing-element" style="">
<select name="type" id="flip-min" data-role="slider">
<option value="yes">yes</option>
<option value="no">no</option>
</select>
<div style="display: inline-block; vertical-align: top;">
<label for="amount" style="margin:6px 6px 0 0">Amount:</label>
<input style="display: inline-block; margin-top: 2px" name="amount" id="amount" value="" type="text">
</div>
</div>
<input type="submit" value="Submit" name="Submit_button"><input type="reset" value="Reset" name="Reset_button">
</form>
</body>
</html>
检查这一项http://jsfiddle.net/aravinth/Y6cqC/1/ – Aravin
这是一个不错的开始,但我希望它到滑块行动更新以及切换。 – Bestrafung
现在检查这一个http://jsfiddle.net/Y6cqC/2/ – Aravin