I am working on http://gamercity.info/ymusic/. And I am using UI slider as seek bar. While the video is played I want to invoke a seekTo(seconds)
function if user clicked anywhere on the seek bar. How to get new value of seconds
after click event?
我正在研究http://gamercity.info/ymusic/。我用UI滑动条作为搜索条。在播放视频时,如果用户单击搜索栏上的任何位置,我希望调用seekTo(seconds)函数。如何在单击事件后获得新的秒值?
8 个解决方案
#1
62
To read slider value/percentage value at anytime:
随时读取滑块值/百分比值:
var val = $('#slider').slider("option", "value");
#2
23
$('#slider').slider({
change: function(event, ui) {
alert(ui.value);
}
});
http://jqueryui.com/demos/slider/
http://jqueryui.com/demos/slider/
#3
12
var val = $("#slider").slider("value");
#4
5
$("#slider").slider(
{
value:100,
min: 0,
max: 500,
step: 50,
slide: function( event, ui ) {
$( "#slider-value" ).html( ui.value );
}
}
);
JS FIDDLE EXAMPLE : http://jsfiddle.net/hiteshbhilai2010/5TTm4/1162/
JS提琴示例:http://jsfiddle.net/hiteshbhilai2010/5TTm4/1162/
you can have a function like this
你可以有一个像这样的函数
function seekTo(seek_value)
{
$("#slider").slider('option', 'value',seek_value);
}
#5
3
I checked all the answers mentioned above, but found none useful as the following code:
我检查了上面提到的所有答案,但是没有找到有用的代码如下:
$('#slider').slider("values")[0]; // for slider with single knob or lower value of range
$('#slider').slider("values")[1]; // for highest value of range
Tested with jQuery v2.1.1 and jQuery-ui v1.12.1
使用jQuery v2.1.1和jQuery-ui v1.12.1测试。
#6
0
You can pass the value to any function or set any element with the value:
您可以将值传递给任何函数,或设置任何元素的值:
$(function () {
$('#slider').slider({
max: 100,
slide: function (event, ui) {
$('#anyDiv').val(ui.value);
}
});
});
#7
0
Late to the party but this question has still unanswered.
但这个问题至今仍未得到解答。
Below example will show you how to get value on change in an input field to save in DB:
下面的示例将向您展示如何在输入字段中获取值,以保存在DB中:
$( "#slider-videoTransparency" ).slider({
value: "1",
orientation: "horizontal",
range: "min",
max: 30,
animate: true,
change: function (e, ui) {
var value = $(this).slider( "value" );
$('.video_overlay_transparency').val(value);
}
});
<div id="slider-videoTransparency" class="slider-danger"></div>
<input type="hidden" name="video_overlay_transparency" class="video_overlay_transparency" value="">
#8
0
var value=document.getElementById('slider').value;
var a=value.split("specialName")//name=special charcter between minimum and maximum rang
var b=a[0];//this will get minimum range
var c=a[1];//this will get maximum range
#1
62
To read slider value/percentage value at anytime:
随时读取滑块值/百分比值:
var val = $('#slider').slider("option", "value");
#2
23
$('#slider').slider({
change: function(event, ui) {
alert(ui.value);
}
});
http://jqueryui.com/demos/slider/
http://jqueryui.com/demos/slider/
#3
12
var val = $("#slider").slider("value");
#4
5
$("#slider").slider(
{
value:100,
min: 0,
max: 500,
step: 50,
slide: function( event, ui ) {
$( "#slider-value" ).html( ui.value );
}
}
);
JS FIDDLE EXAMPLE : http://jsfiddle.net/hiteshbhilai2010/5TTm4/1162/
JS提琴示例:http://jsfiddle.net/hiteshbhilai2010/5TTm4/1162/
you can have a function like this
你可以有一个像这样的函数
function seekTo(seek_value)
{
$("#slider").slider('option', 'value',seek_value);
}
#5
3
I checked all the answers mentioned above, but found none useful as the following code:
我检查了上面提到的所有答案,但是没有找到有用的代码如下:
$('#slider').slider("values")[0]; // for slider with single knob or lower value of range
$('#slider').slider("values")[1]; // for highest value of range
Tested with jQuery v2.1.1 and jQuery-ui v1.12.1
使用jQuery v2.1.1和jQuery-ui v1.12.1测试。
#6
0
You can pass the value to any function or set any element with the value:
您可以将值传递给任何函数,或设置任何元素的值:
$(function () {
$('#slider').slider({
max: 100,
slide: function (event, ui) {
$('#anyDiv').val(ui.value);
}
});
});
#7
0
Late to the party but this question has still unanswered.
但这个问题至今仍未得到解答。
Below example will show you how to get value on change in an input field to save in DB:
下面的示例将向您展示如何在输入字段中获取值,以保存在DB中:
$( "#slider-videoTransparency" ).slider({
value: "1",
orientation: "horizontal",
range: "min",
max: 30,
animate: true,
change: function (e, ui) {
var value = $(this).slider( "value" );
$('.video_overlay_transparency').val(value);
}
});
<div id="slider-videoTransparency" class="slider-danger"></div>
<input type="hidden" name="video_overlay_transparency" class="video_overlay_transparency" value="">
#8
0
var value=document.getElementById('slider').value;
var a=value.split("specialName")//name=special charcter between minimum and maximum rang
var b=a[0];//this will get minimum range
var c=a[1];//this will get maximum range