2

こんにちは皆さん、私はこの小さな問題を解決するために何時間も費やしてきました。このjQueryノブを使用して、各ポイントで異なるjQueryアニメーションをトリガーしたいと思います。値を検出できないようですか?

<script>
    $(document).ready(function(){
        $('.knob').bind('change', function(){
            var newvalue = $(this).val();
            if (newvalue == 50) {
                alert("newvalue is 50!");
            }; 
        });
    });
</script>

<input class="knob" data-width="530" data-min="0" data-max="67" data-angleOffset="0" data-thickness=".1" data-displayPrevious="true">

どうすればこれを行うことができますか?あなたが助けることができることを願っています!

4

5 に答える 5

3
$(".knob").knob({
    change: function (value) {
        console.log("changed to: " + value);
    }
});
于 2012-07-06T17:06:15.860 に答える
1

少し遅れましたが、同じ質問に出くわしました。最終的には次のようになりました。

$('.dial').trigger('configure', {
    'change': function (v) {
        console.log('new value' + v);
    }
});
于 2012-12-23T21:44:38.633 に答える
0

ラベルのフォントサイズは次の方法で制御できます:-

$(".knob").css('font-size','15px');
you can set the font size of your own choice like 20px,30px,etc.

if you are getting the chart build dynamically then here is the javascript/jquery code for you

********javascript**************
var a = document.getElementsByClassName("knob");
for (var i = 0; i
if (a[i].value > 400) a[i].style.fontSize = "15px";
}
again here you can set the font - size of your choice.

* * * * * * * jquery * * * * * * * * * * * * * * * * * * * * *
var a = $('.knob');
a.each(function () {
    if (this.value > 99999) this.style.fontSize = "15px";
    if (this.value > 9999 && this.value <= 99999) this.style.fontSize = "17px";
    else if (this.value > 999 && this.value <= 9999) this.style.fontSize = "20px";
});

apply as many conditions as you want and change the font size.
于 2013-07-26T14:03:22.117 に答える
0

ここの例を見ると、最初の引数として値が渡されます。

$('.knob').bind('change', function(val){ console.log(val); });
于 2012-07-06T17:06:58.187 に答える