Comments (12)
did you find an answer to this?
from jquery-knob.
I am also having this issue...
from jquery-knob.
I haven't found an answer and being honnest I haven't search as well... I needed this functionality for a scolar project and this project had to be finish in June so I stopped searching and did with the existing functionality.
from jquery-knob.
To make it work you need to add a few lines to the code.
In line # 74 you need to call the "_listen" method. Like this:
var cf = function (e, conf) {
var k;
for (k in conf) {
s.o[k] = conf[k];
}
s.init();
s._configure()
._listen()
._draw();
};
Then, in the "_listen" method at line arround # 320 just add these few lines in the "else":
} else {
this.$c.unbind("mousedown");
this.$c.unbind("touchstart");
this.$.attr('readonly', 'readonly');
}
Then you need to call the change:
$('.knob').trigger('configure',{'readOnly': true});
from jquery-knob.
Thanks @saenzramiro ! Is there a pull request for this fix ?
from jquery-knob.
not yet, for up and down arrows are still not readonly
add this line in the "else" in the "_listen" method:
this.i.unbind("keydown");
from jquery-knob.
Codes has changed a bit, this hack doesn't work anymore. =(
from jquery-knob.
The hack still works.. the only difference is that the line numbers have changed.
From Line #74 to #80.
From Line #320 to #419.
from jquery-knob.
👍 for a pull request on this
from jquery-knob.
For others who are also looking at this issue,
if you update the _listen function to look like this, the scroll wheel and arrow keys will function as intended.
this._listen = function () {
if (!this.o.readOnly) {
this.$.removeAttr('readonly');
this.$c.unbind('mousedown');
this.$c.unbind('touchstart');
this.$.unbind('keydown');
this.$c.unbind("mousewheel DOMMouseScroll");
this.$.unbind("mousewheel DOMMouseScroll");
this.$.unbind('keyup');
this.$c
.bind(
"mousedown",
function (e) {
e.preventDefault();
s._xy()._mouse(e);
}
)
.bind(
"touchstart",
function (e) {
e.preventDefault();
s._xy()._touch(e);
}
);
this.listen();
} else {
this.$c.unbind('mousedown');
this.$c.unbind('touchstart');
this.$.unbind('keydown');
this.$c.unbind("mousewheel DOMMouseScroll");
this.$.unbind("mousewheel DOMMouseScroll");
this.$.attr('readonly', 'readonly');
}
if (this.relative) {
$(window).resize(function () {
s._carve().init();
s._draw();
});
}
return this;
};
from jquery-knob.
So how do we update readonly?
from jquery-knob.
with the last code provided it doesn't work :(
somebody can help ? Thanks
from jquery-knob.
Related Issues (20)
- nditions
- Problem when resize viewport, width & formatting value HOT 1
- JQuery-Knob - Angular 5 HOT 4
- when value="0" and lineCap: 'round' , on firefox browser bug HOT 1
- Issue with step
- Big Numbers HOT 5
- How do I get the old value of knob?
- Remove space between two dial selection
- Problem with digit leaving the Dial on small screen HOT 2
- not a issue but easy way to get in contact with
- Jquery-knob in foreignObject
- Force JQuery-knob to not exceed max amount
- Add custom label in center of knob
- Compatibility problem with Select2
- Num key pad, (.) is not working.
- When a PHP variable is passed in the value, it doesn't print the value, only 0
- how to reset gfx on knob? HOT 1
- Trigger return NaN
- Design issue.
- This always sets inline to true regardless of inline:false in initialization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-knob.