Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery seems to be running multiple calls simultaneously
    primarykey
    data
    text
    <p>Sorry, but apparently I don't understand chaining enough to figure out this problem...</p> <p>I'm implementing a jQuery carousel plugin (jCarouselLite) and I'm trying to add an option to 'remove' one of the carousel items (currently <code>&lt;div class="remove"&gt;</code>)...</p> <pre><code>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) } </code></pre> <p>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. </p> <p>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 <code>self.refreshDisplay(itemId);</code> line and it fades out and removes as expected.</p> <p>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. </p> <p>Any and all help is appreciated, thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload