diff options
Diffstat (limited to 'plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js')
-rw-r--r-- | plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js index 90f8ed76..bedb5b52 100644 --- a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js +++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js @@ -9,13 +9,13 @@ var TiledGallery = function() { $( window ).on( 'resize', function () { clearTimeout( self.resizeTimeout ); - + self.resizeTimeout = setTimeout( function () { self.resize(); }, 150 ); } ); // Make any new galleries loaded by Infinite Scroll flexible $( 'body' ).on( 'post-load', $.proxy( self.initialize, self ) ); - + // Populate and set up captions on newdash galleries. $( document ).on( 'page-rendered.wpcom-newdash', $.proxy( self.populate, self ) ); @@ -51,9 +51,10 @@ TiledGallery.prototype.Captions = function() { /* Hide captions */ this.caption.hide(); - this.item.on( 'hover', function() { - $( this ).find( '.tiled-gallery-caption' ).slideToggle( 'fast' ); - }); + this.item.hover( + function() { $( this ).find( '.tiled-gallery-caption' ).slideDown( 'fast' ); }, + function() { $( this ).find( '.tiled-gallery-caption' ).slideUp( 'fast' ); } + ); }; TiledGallery.prototype.resize = function() { @@ -61,7 +62,7 @@ TiledGallery.prototype.resize = function() { this.gallery.each( function ( galleryIndex, galleryElement ) { var thisGallery = $( galleryElement ); - + // All images must be loaded before proceeding. var imagesLoaded = true; @@ -134,6 +135,8 @@ TiledGallery.prototype.resize = function() { .width( Math.floor( resizeRatio * thisGalleryElement.data( 'original-width' ) ) - thisGalleryElement.data( 'extra-width' ) ) .height( Math.floor( resizeRatio * thisGalleryElement.data( 'original-height' ) ) - thisGalleryElement.data( 'extra-height' ) ); } ); + + thisGallery.removeClass( 'tiled-gallery-unresized' ); } ); }; |