Support » Plugin: Jetpack by WordPress.com » BUG: jQuery mouseover caption incorrectly stacks tweens

  • Resolved Magi182

    (@magi182)


    The hover effect for the tiled gallery annoyingly stacks up the tweens. If you mouse over and back several times in quick succession, the current script will execute an animation on the caption for every mouseover/mouseout. A more desireable effect would be to have the animation animate to the current state of the mouse, and if extra tweens are fired, to discard them.

    Current code:

    /**
     * Story
     */
    TiledGallery.prototype.Captions = function() {
    	/* Hide captions */
    	this.caption.hide();
    
    	this.item.hover(
    		function() { $( this ).find( '.tiled-gallery-caption' ).slideDown( 'fast' ); },
    		function() { $( this ).find( '.tiled-gallery-caption' ).slideUp( 'fast' ); }
    	);
    };

    Would work better if stop() was added to kill any active tween before a new tween was executed:

    /**
     * Story
     */
    TiledGallery.prototype.Captions = function() {
    	/* Hide captions */
    	this.caption.hide();
    
    	this.item.hover(
    		function() { $( this ).find( '.tiled-gallery-caption' ).stop(true, true).slideDown( 'fast' ); },
    		function() { $( this ).find( '.tiled-gallery-caption' ).stop(true, true).slideUp( 'fast' ); }
    	);
    };

    http://wordpress.org/plugins/jetpack/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘BUG: jQuery mouseover caption incorrectly stacks tweens’ is closed to new replies.