Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:12:00+00:00 2026-06-15T11:12:00+00:00

I am using jQuery knob with option data-displayPrevious=true . I need a little change

  • 0

I am using jQuery knob with option data-displayPrevious=true.

I need a little change in behavior:

If user changes value up it should stop at maximum value and not jump to minimum after overflow maximum. And if user change value down it should stop at minimum.
Exactly like this: http://demo.tutorialzine.com/2011/11/pretty-switches-css3-jquery/

Can you help me with this, please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:12:01+00:00Added an answer on June 15, 2026 at 11:12 am

    This is a crude example of an approach you could do. http://jsfiddle.net/KjtSP/

    It has some issues, like not continuing the drag if you go back, but other than that it should serve as a pretty good basis for you concept. Basically what I’m doing is checking the value that the knob wants to set before it does, and if it fits in the criteria of being either over the maximum or below the minimum so to speak, I cancel the current mouse-event.

    By returning false we prevent the plugin from setting the value it received.

    var knob = $(".dial");
    lastValue = 0;
    max = 100;
    min = 0;
    variance = Math.floor(max / 5);
    
    knob.knob({
        "change": function(v) {
            if (v > max - variance && lastValue < min + variance) {
                knob.val(0).change();
                return false;
            } else if (v < min + variance && lastValue > max - variance) {
                knob.val(100).change();
                return false;
            }
            lastValue = v;
        }
    });​
    

    Update

    Since returning false does prevent the setting of the new value, what you could do is not call the mouseup ergo allowing the continuation of the process. A little tweak of my code, resulting in the following fiddle, allows you to do what you wanted.

    The only quirk you encounter with this code is that if you go over the tolerance or threshold set in the code, your knob will go to that value, but personally I believe that’s how it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this jQuery knob. http://anthonyterrien.com/knob/ I'm using semi circle & i need to
Using jQuery 1.6.2 HTML that I'm operating on <select id=langId> <option value=0>Argentina - Spanish</option>
Using jQuery, I'm trying to change the selected option in a SELECT element to
using jQuery I have the following code: var selectedIdsArray = $(#selectId option:selected).map(function(){return this.value;}); var
Using JQuery, I need to know if the User clicked on the link or
Using jquery, how can I change the color of these elements to red if
Using jQuery, how can I get the selected item's value in a select when
Using jQuery 1.7.1, I'm trying to create an event handler for the change event
Using Jquery AJAX to get a value from a PHP script. This line works
Using Jquery Ajax i have an entry script index.php This script lets the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.