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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:12:43+00:00 2026-06-17T12:12:43+00:00

Demo: http://jsfiddle.net/sunnycpp/fMXyP/5/ Consecutive show,hide calls produces a bug, Animation stops and does not resume

  • 0

Demo: http://jsfiddle.net/sunnycpp/fMXyP/5/

Consecutive show,hide calls produces a bug, Animation stops and does not resume sometimes. Is this jQuery bug or bug in my code?

Here is the code copy-pasted from jsfiddle.

myButtonManual.on("click", function() {
  isVisible = !isVisible;      
  myHero.stop(true,false);      
  if(isVisible) {        
    myHero.show('slow');
    myButtonManual.text("Manual Hide");
  } else {        
    myHero.hide('slow');
    myButtonManual.text("Manual Show");
  }   

enter image description here

  • 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-17T12:12:45+00:00Added an answer on June 17, 2026 at 12:12 pm

    That isn’t a bug.

    Taking a look at this line:

    myHero.stop(true,false);
    

    When you stop a .hide() at the middle of it without jumping to the end of animation, an element that is visible will stay visible.

    Your logic isVisible = !isVisible will be broken then as .stop()ing a hide() leaves the element still visible, meaning that the next call to the handler will execute .show() on a visible element that will have absolutely no effect.

    Workarounds include:

    • Remove the .stop(), this will queue the show() and execute it after the hide() concludes;

    • Use .stop(true) – equivalent to .stop(true, true) -, this will be rather bluntly as it will force the animation to conclude as it suddenly starts the next;

    Edit: The closest way to reproduce a .toggle()-like behavior using the .show() and .hide() methods is to simply add a .css('display', 'none') before calling .show(), this will ensure that .show() has the desired effect:

    isVisible = !isVisible;
    myHero.stop(true, false);
    if (isVisible) {
      myHero.css('display', 'none').show('slow');
    } else {
      myHero.hide('slow');
    }
    

    Fiddle

    If the element is already hidden, the .css will have no effect; if the element is partially shown, it will hide it ensuring that .show() executes instead of being ignored due to the element being considered visible.

    This has the same effect as the .stop(true, false).toggle(), but works using the 2 different .show()/.hide() methods as requested.

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

Sidebar

Related Questions

Demo: http://jsfiddle.net/nazym/1/ The code meant to show a popup when button pressed and hide
Why Chrome does not show CSS ::-webkit-scrollbar scrollbar for iframe? Demo http://jsfiddle.net/laukstein/C9s3P/ <iframe scrolling=yes
Hi I have this Demo: http://jsfiddle.net/SO_AMK/BcFVv/ I am trying to show only 1 Div
Demo: http://jsfiddle.net/sunnycpp/MPACc/4/ Same code copy-pasted here: HTML <div class=container> <debug-bar ng-controller=parentController> <debug-bar ng-controller=childController> <debug-bar
Im having a big headcache with a header design: Here the demo: http://jsfiddle.net/uGECm/ The
Please see demo here: http://jsfiddle.net/mA6qm/1/ (expand console) Why aren't events being sent or received
Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
Demo: http://jsfiddle.net/55ucw/1/ In any browser other than Safari or Chrome, I can tab into
Live demo: http://jsfiddle.net/stapiagutierrez/KKdsb/29/ I'm just trying to create my own star rating UI for
how to set float element next to inline element with dynamic width demo: http://jsfiddle.net/J2Df8/

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.