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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:53:45+00:00 2026-05-23T08:53:45+00:00

This question is related to this question yesterday . Please see current jsfiddle here

  • 0

This question is related to this question yesterday. Please see current jsfiddle here.

I’ve been able to get it working so that the clicked div scales and animates nicely. But I now have 2 other problems:

  1. Once the clicked div has been scaled back to original size, the script won’t run when I click the same div again to repeat the action.

  2. I’m not really happy with the jumpy rescaling/repositioning. I can’t seem to get it to work as smoothly. I guess I’d be okay with it as is, but I’d be a lot happier if it was as smooth as the initial scale/animation.

Please let me know if I need to be clearer.

Any assistance would be much appreciated! MTIA.

  • 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-23T08:53:46+00:00Added an answer on May 23, 2026 at 8:53 am

    It won’t work a second time because you remove the click handler from it when making it not current anymore:

    selectedBox.unbind('click');
    

    That unbinds all click handlers from the div, including the one you hooked up in ready initially.

    Four options:

    1. Don’t unbind the main click, and use jQuery’s event “namespacing” for the second click event:

      $('.current').bind('click.current', function() {
      

      …and then when unbinding:

      selectedBox.unbind('click.current');
      

      Be sure to stop the event in the current click handler, so the main click handler isn’t run (jQuery makes sure handlers are run in reverse order of being hooked up, so you know the current handler will run before the main handler, cross-browser). Never mind, sorry, it’s the other way around: jQuery ensures they run in the order they were bound, not reverse order.

    2. Use a named function for the current click event:

      $('.current').click(currentClick);
      function currentClick() {
      

      …and remove it specifically:

      selectedBox.unbind('click', currentClick);
      

      …and again, don’t remove the main handler.

    3. Use delegate rather than click for the main (non-current) click:

      $('#content').delegate('.box', 'click', boxClickHandler);
      

      That hooks up the click event on the container of the boxes, not the boxes themselves, and then responds to clicks because they bubble.

      In your “current” click handler, be sure to cancel the click event so it doesn’t bubble up to the container.

      Here’s a fiddle with that change implemented. I also namedspaced the “current” click just to be friendly to any other code that might also need to know when a box is clicked.

    4. Put the boxClickHandler back after removing the current click handler:

      selectedBox.unbind('click').click(boxClickHandler);
      
    5. Use a single handler and branch within the handler depending on whether you see the “current” class on the box.

    …or some combination of the above.

    I like #5 the best.

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

Sidebar

Related Questions

This problem is related to This question I asked yesterday. Now it seems that
This is in part related to my question yesterday. So here is the data
This question is related to another question which I asked yesterday! List all links
This question is related to a previous post of mine Here . Basically, I
This question is related to the question posted here: Why isn't my custom WCF
(This question is related to another one , but different enough that I think
This question is related to the codebreaker example found in the RSpec book. See
This question is related to another I ask recently, it can be found here
This question is related to this post but I don't see how I can
I asked a related question on this yesterday, and was told what not to

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.