Javascript 从jQuery移动滑块提起手指时如何存储滑块值
我想将滑块的值存储在下面的代码中的警报消息中,在这里我有占位符警报“停止” 我在以下站点找到了代码: 我尝试过各种解决办法,但都是空手而归。Javascript 从jQuery移动滑块提起手指时如何存储滑块值,javascript,jquery,html,jquery-mobile,Javascript,Jquery,Html,Jquery Mobile,我想将滑块的值存储在下面的代码中的警报消息中,在这里我有占位符警报“停止” 我在以下站点找到了代码: 我尝试过各种解决办法,但都是空手而归。 变量选择=$.selector.slidervalue;在jQuery API中,但我不知道如何在上面的代码中实现它。请听更改事件。你不需要自己处理触摸事件。我需要用户从滑块上抬起手指时的值。在更改事件中,该值会不断更新。第一个答案是有效的,但是当我尝试从另一个页面调用带有滑块的页面时,它不再有效。有什么想法吗?$page_id msBig.val,如果
变量选择=$.selector.slidervalue;在jQuery API中,但我不知道如何在上面的代码中实现它。请听更改事件。你不需要自己处理触摸事件。我需要用户从滑块上抬起手指时的值。在更改事件中,该值会不断更新。第一个答案是有效的,但是当我尝试从另一个页面调用带有滑块的页面时,它不再有效。有什么想法吗?$page_id msBig.val,如果您想从另一个页面调用它。能否详细说明我将在函数calljQuery'msBig.val;中放置$page_id msBig.val的位置;或者在哪里?请使用更多详细信息更新您的问题,即您希望何时从哪个页面获取滑块的值。
<head>
<title>Page 1</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/ui.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/jquery.mobile.structure-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function () {
//depending on the device we have a touch or a mouse event
var supportTouch = jQuery.support.touch,
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
touchStopEvent = supportTouch ? "touchend" : "mouseup",
touchMoveEvent = supportTouch ? "touchmove" : "mousemove";
//the event is binded to the .ui-slider inside of the input type range
jQuery('#msBig').siblings('.ui-slider').bind(touchStopEvent,function() {
alert('stop')
});
});
</script>
</head>
<body>
<div id="page1" data-role="page">
<div data-role="header">
<h1>Page Title</h1>
</div><!-- /header -->
<div data-role="content">
<input type="range" id="msBig" value="50" tabindex="0" data-theme="b" max="100" min="0" size="3" />
</div><!-- /content -->
<div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>