WordPress.org

Plugin Directory

jetpack

Opened 4 years ago

Closed 4 years ago

#1966 closed defect (duplicate)

Tiled Galleries: jQuery mouseover caption incorrectly stacks tweens

Reported by: magi182 Owned by: tmoorewp
Priority: normal Severity: normal
Plugin: jetpack Keywords: tiled-galleries, jQuery, tween, animation, has-patch
Cc: richard@…

Description

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.

/**
 * 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' ); }
	);
};

Attachments (1)

1966.diff (708 bytes) - added by jeherve 4 years ago.
Tiled Galleries: update jQuery mouseover caption effect, props magi182

Download all attachments as: .zip

Change History (5)

comment:1 @jeherve4 years ago

  • Keywords tiled-galleries has-patch added
  • Summary changed from jQuery mouseover caption incorrectly stacks tweens to Tiled Galleries: jQuery mouseover caption incorrectly stacks tweens

@jeherve4 years ago

Tiled Galleries: update jQuery mouseover caption effect, props magi182

comment:3 @richardmtl4 years ago

  • Cc richard@… added

comment:4 @jeherve4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.