Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alt text to images #401

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/galleria.js
Original file line number Diff line number Diff line change
Expand Up @@ -3423,6 +3423,7 @@ Galleria.prototype = {

// get source from thumb or image
src = data.thumb || data.image;
alt = data.title || data.description;

if ( ( o.thumbnails === true || optval == 'lazy' ) && ( data.thumb || data.image ) ) {

Expand Down Expand Up @@ -3454,7 +3455,8 @@ Galleria.prototype = {
width : Utils.parseValue( getStyle( 'width' ) ),
height : Utils.parseValue( getStyle( 'height' ) ),
order : i,
src : src
src : src,
alt : alt
};

// grab & reset size for smoother thumbnail loads
Expand Down Expand Up @@ -6340,7 +6342,7 @@ Galleria.Picture.prototype = {
});

// begin load and insert in cache when done
$image.on( 'load', onload ).on( 'error', onerror ).attr( 'src', src );
$image.on( 'load', onload ).on( 'error', onerror ).attr( 'src', src ).attr('alt', alt);

// return the container
return this.container;
Expand Down