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 905839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:17:16+00:00 2026-05-15T16:17:16+00:00

I have a jquery based slider on the page. This slider calls a function

  • 0

I have a jquery based slider on the page. This slider calls a function to update a variable each time a value changes and does a few other things. This means that the function is called too often when the slider handle is being dragged. And this is causing performance issues.

Current Psudo:

Slider.onSlide: trigger function ValueChange(V)
function ValueChange(V) {Variable=V; other code;};

I want to change the value only if X number of milliseconds (300) have passed since the last change. This will greatly improve performance.

The aim here is to reduce the number of times ValueChange(V) is triggered while sliding. Only a time delay will not work here, it is important that;

  1. The last value of the slider is always set even if the last slide position was within the X number of seconds period. (although it can be set after X number of seconds and not immediately)

  2. The value is changed to the latest slider position value and not the slider position value X number of seconds before.

  3. I think an intermediate function is required that then calls ValueChange(V) if these two checks above pass.

I hope it made sense … really need help with this …. its too complicated for my under developed brain … really ! 😀

Thanks in advance,
Norman.

P.S: A jQuery solution to this is also welcome since I have the library available.

  • 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-05-15T16:17:17+00:00Added an answer on May 15, 2026 at 4:17 pm

    Store the value in a variable each time it changes, and use a function that runs on an interval to check if the value has changed:

    var currentValue, lastValue;
    
    function ValueChange(V) {
      currentValue = V;
    };
    
    window.setInterval(function(){
      if (lastValue != currentValue) {
        lastValue = currentValue;
        Variable = currentValue; other code;
      }
    }, 50);
    

    I chose an interval of 50 ms. as that is a resonable interval for animating things. You can try to use the interval 300 ms., but that will only update three times a second, which may look jerky.

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

Sidebar

Ask A Question

Stats

  • Questions 464k
  • Answers 464k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is a good starting point of a WCF REST… May 16, 2026 at 12:55 am
  • Editorial Team
    Editorial Team added an answer You can build the signature using ASM's SignatureWriter class. For… May 16, 2026 at 12:55 am
  • Editorial Team
    Editorial Team added an answer I don't believe you can do so. You can set… May 16, 2026 at 12:55 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.