Adds the image size to gallery nav (waiting the image load) (#31407)

* adds the image size to gallery nav

* replaces tabs with spaces

Co-authored-by: Erik Golinelli <erik@codekraft.it>
This commit is contained in:
Jeff Stieler 2021-12-09 15:22:07 -05:00 committed by GitHub
parent fedb5e9677
commit 7f86a45292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -242,8 +242,15 @@
} }
item = $( '<a></a>' ).attr( 'href', '#' ).text( j ); item = $( '<a></a>' ).attr( 'href', '#' ).text( j );
if ( slider.vars.controlNav === "thumbnails" ) { if (slider.vars.controlNav === "thumbnails") {
item = $( '<img/>' ).attr( 'src', slide.attr( 'data-thumb' ) ); item = $('<img/>', {
load: function (el) {
el.currentTarget.width = el.currentTarget.naturalWidth;
el.currentTarget.height = el.currentTarget.naturalHeight;
},
src: slide.attr('data-thumb'),
alt: slide.attr('alt')
})
} }
if ( '' !== slide.attr( 'data-thumb-alt' ) ) { if ( '' !== slide.attr( 'data-thumb-alt' ) ) {