Jquery 一起添加值的Dragdealer滑块
我正试图使用Dragdealer创建一个小游戏,但我的格式一直出错。我想将这两个值相加,并确保它们仍然同步,因此彼此之间的距离不超过20个位置Jquery 一起添加值的Dragdealer滑块,jquery,html,dragdealer-js,Jquery,Html,Dragdealer Js,我正试图使用Dragdealer创建一个小游戏,但我的格式一直出错。我想将这两个值相加,并确保它们仍然同步,因此彼此之间的距离不超过20个位置 <div id="wrapper"> <div class="content-scroller1"> <div id="content-scroller1" class="dragdealer"> <div class="handle red
<div id="wrapper">
<div class="content-scroller1">
<div id="content-scroller1" class="dragdealer">
<div class="handle red-bar" style="-webkit-perspective: 1000px; -webkit-backface-visibility: hidden; -webkit-transform: translateY(0px);">
<span class="value1"></span>
</div>
</div>
<div class="content-scroller2">
<div id="content-scroller2" class="dragdealer">
<div class="handle red-bar" style="-webkit-perspective: 1000px; -webkit-backface-visibility: hidden; -webkit-transform: translateY(0px);">
<span class="value2"></span>
</div>
</div>
<input type="button" value="Get slider value" id="button1" />
</div>
new Dragdealer('content-scroller1', {
horizontal: false,
vertical: true,
yPrecision: 100,
animationCallback: function(x, y) {
$('.content-scroller1 .value1').text(Math.round(y * 100));
}
});
new Dragdealer('content-scroller2', {
horizontal: false,
vertical: true,
y: 1,
yPrecision: 100,
animationCallback: function(x, y) {
$('.content-scroller2 .value2').text(Math.round(y * 100));
}
});
var syncTest = function () {
var posOne = parseInt($('.content-scroller1 .value1').text());
var posTwo = parseInt($('.content-scroller2 .value2').text());
if ((posOne + posTwo > 90) && (posOne + posTwo < 110)); {
alert($('yes'));
}
};
新的Dragdealer('content-scroller1'{
水平:错,
是的,
精度:100,
animationCallback:函数(x,y){
$('.content-scroller1.value1').text(Math.round(y*100));
}
});
新的Dragdealer('content-scroller2'{
水平:错,
是的,
y:1,,
精度:100,
animationCallback:函数(x,y){
$('.content-scroller2.value2').text(Math.round(y*100));
}
});
var syncTest=函数(){
var posOne=parseInt($('.content-scroller1.value1').text();
var posTwo=parseInt($('.content-scroller2.value2').text();
如果((posOne+posTwo>90)和&(posOne+posTwo<110)){
警报($(‘是’);
}
};
83
没有属性-值
将val()
更改为text()
这一切似乎都不起作用了吗?span类值通过javascript插入。感谢JSFIDLE的帮助!
var posOne = parseInt($('.content-scroller1 .value1').text());
var posTwo = parseInt($('.content-scroller2 .value2').text());