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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:34:40+00:00 2026-05-18T11:34:40+00:00

Sorry, but apparently I don’t understand chaining enough to figure out this problem… I’m

  • 0

Sorry, but apparently I don’t understand chaining enough to figure out this problem…

I’m implementing a jQuery carousel plugin (jCarouselLite) and I’m trying to add an option to ‘remove’ one of the carousel items (currently <div class="remove">)…

initEvents: function() {
        var self = this;
        // Bind jQuery event for REMOVE button click
        $('.remove').live('click', function() {     
            // Need to save the ID that we're removing
            var item = $(this).closest('li.sort');
            var itemId = item.attr("id");

            $(this).removeItem();

            self.refreshDisplay(itemId);
        }); 


 $.fn.removeItem = (function() {
  var item = this.closest('li.sort'); // could save this call by passing param

  item.fadeOut("normal", function() {
         $(this).remove();
      });

   // preserve jQuery chain
   return this;
 });
},

refreshDisplay(itemId) {
  // ...
  // redraws carousel
  // ...
  // itemId is used to remove from the array of Items to show (class-wide scope)
}

Since there’s no clean way to ‘refresh’ the jCarouselLite plugin (maybe something I’ll try implementing in the actual plugin later) the quick and dirty fix for this is to just regenerate the Carousel.

The issue is I’m trying to fade out the element clicked, however, it seems like the refreshDisplay() is called before the animation of fading out (and removing) the clicked item is completed. I’ve verified this by commenting out the self.refreshDisplay(itemId); line and it fades out and removes as expected.

So I guess there’s a certain way I need to chain this? I’ve done a couple hours of reading on how chaining works and I thought I understood it, but apparently not.

Any and all help is appreciated, thanks!

  • 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-18T11:34:41+00:00Added an answer on May 18, 2026 at 11:34 am

    The purpose of chaining is to allow multiple commands to share a base object, but it doesn’t cause each command to wait for the previous one.

    For that, you need to use a callback. Something like

    initEvents: function() {
            var self = this;
            // Bind jQuery event for REMOVE button click
            $('.remove').live('click', function() {     
                // Need to save the ID that we're removing
                var item = $(this).closest('li.sort');
                var itemId = item.attr("id");
    
                $(this).removeItem(function() {
                    self.refreshDisplay(itemId);
                });
            }); 
    
    
     $.fn.removeItem = (function(callback) {
      var item = this.closest('li.sort'); // could save this call by passing param
    
      item.fadeOut("normal", function() {
             $(this).remove();
             callback();  //now your refresh is being called after the fade.
          });
    
       // preserve jQuery chain
       return this;
     });
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok sorry this might seem like a dumb question but I cannot figure this
Sorry for this not being a real question, but Sometime back i remember seeing
Sorry if this sounds like a really stupid question, but I need to make
I'm sorry, but this keyword doesn't mean anything to me... Can someone give me
This works in Opera but apparently nothing else. HTML <input type=checkbox name=iphone value=checked checked=checked
Sorry but this is really confusing me and I know the answer is staring
sorry but I do not have the actual code with me, but I will
Sorry about the vague subject but I couldn't think what to put. Here's my
Sorry for the simple question but I feel like there's a smarter way to
Sorry for my ignorance here, but when I hear the word webserver, I immediately

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.