闪亮的旋钮控制

Shiny Knob Control

本文关键字:控制      更新时间:2023-09-26

我正在处理一个项目,我需要 knobe 元素(我知道有每个人都共享的库,但无法自定义它,我需要一些我可以放置图像像 knobe 元素)

我找到了这个图书馆,http://tutorialzine.com/2011/11/pretty-switches-css3-jquery/

当我查看代码时,我没有看到我在哪里返回输入值?

以前有人用过吗?或者如果你有类似的东西要推荐?

这是调用库时的代码

$('#control').knobKnob({
        snap : 10,
        value: 154, /// How much I understand this is default value setting 
        turn : function(ratio){
            numBars = Math.round(colorBars.length*ratio);
            // Update the dom only when the number of active bars
            // changes, instead of on every move
            if(numBars == lastNum){
                return false;
            }
            lastNum = numBars;
            colorBars.removeClass('active').slice(0, numBars).addClass('active');
        }
    });

据我所知,插件中不包含任何可以帮助您检索旋钮值的内容。这意味着您必须扩展它才能自己支持此功能。

一种方法是获取旋钮旋转度的值。

我找到了一种在此答案中获取此确切值的方法。

使用该方法时,您可以通过执行以下操作来检索旋钮值:

getRotationDegrees($('#control .knob .top'));
您将获得旋

钮.js文件中的值,该文件位于旋钮文件夹中。

doc.on('mouseup.rem  touchend.rem',function(){
                knob.off('.rem');
                doc.off('.rem');
                // Saving the current rotation
                rotation = currentDeg;                  
                alert(rotation);                    
                // Marking the starting degree as invalid
                startDeg = -1;
            });.

提醒旋转...您将获得旋钮值