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

  • Home
  • SEARCH
  • 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 4003620
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:10:29+00:00 2026-05-20T08:10:29+00:00

here is what I’m trying to do: I have a few div’s with prices

  • 0

here is what I’m trying to do:
I have a few div’s with prices in them, and a slider with fixed minimum where I can set the maximum price. With that I can filter the divs, so only the div’s with prices in the slider range will be displayed.

Without animation it would be no problem, just hide() and show(), but I’m trying to do it smooth.

vehicles[0] = { id: 1, price: 100 };
vehicles[1] = { id: 2, price: 250 };
vehicles[2] = { id: 3, price: 700 };
vehicles[3] = { id: 4, price: 300 };
... 
slide: function(event, ui) {
  for (i = 0; i < vehicles.length; i++) { 
    if (vehicles[i].price > ui.value && $('#vehicle'+vehicles[i].id).data('visible') == true) { 
      $('#vehicle'+vehicles[i].id).data('visible',false).stop(true).hide('blind',500); 
    } 
    if (vehicles[i].price <= ui.value && $('#vehicle'+vehicles[i].id).data('visible') == false) { 
      $('#vehicle'+vehicles[i].id).data('visible',true).stop(true).show('blind',500); 
    } 
  } 
}
...
<div id="vehicle1">100€</div>
<div id="vehicle1">250€</div>
<div id="vehicle1">700€</div>
<div id="vehicle1">300€</div>

That’s my code and here is my problem: When pushing the slider to one side or point, it works fine, but f.e. pushing it to 0€ and immediately back to 700€ (while the hide() animation is still running), all divs are hidden (but their data(‘visible’) is set to true). You can see my running code here: http://work4.bywulf.de/index.php?page=Vehicles Just slide the slider fast to the left and back to the right.

It looks like the stop() method is not correctly stopping their current “hide” animation, and the “show” animation is not playing.

Now what am I doing wrong or is there another way to hide elements animated, but stop them half way and show them again completely?

I hope you know what I mean and what I’m trying to do, thank you for your help.

(jQuery 1.5, jQueryUI 1.8.9)

–Wulf

  • 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-20T08:10:30+00:00Added an answer on May 20, 2026 at 8:10 am

    Problem solved, just did an own .animation(). I think the problem was, that show() and hide() see the item as it is, and when the item is shown only 50%, it struggles. .animation() will start at the 50% and end at the given dimentions. So what I did in detail was:

    First i initialized the container, so the height is saved:

    $(selector).data('visible',true)
      .data('initialHeight',$(selector).height())
      .data('initialOuterHeight',$(selector).outerHeight())
      .data('initialMarginBottom',$(selector).css('marginBottom'));
    

    Then, when animation was needed, this part is executed:

    function startAnimation(selector, show, duration) {
      $(selector).data('visible',show).stop(true);
      if (show) {
        $(selector).animate({ 
          height: $(selector).data('initialHeight'), 
          opacity: 1 , 
          marginTop: 0,
          marginBottom: $(selector).data('initialMarginBottom') 
        }, duration);
      } else {
        $(selector).animate({ 
          height: 0, 
          opacity: 0 , 
          marginTop: $(selector).data('initialHeight') - $(selector).data('initialOuterHeight'),
          marginBottom: 0 
        }, duration);
      }
    }
    

    Thanks for your advice anyway.

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

Sidebar

Related Questions

Here is what I am trying to achieve in PHP: I have this string:
Here the total height of all <div> 's are 900 pixels, but the jQuery
Here is a complete example. I want to forbid using A::set from objects casted
Here's my scenario: <!-- Normal Control --> <div class=required> <label for=address1>Address line 1</label> <input
Basically, what I'm trying to create is a page of div tags, each has
I have a jquery bug and I've been looking for hours now, I can't
Here's the basic setup: I have a thin bar at the top of a
Here is my problem : I have a post controller with the action create.
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:

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.