Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Missing Alt Attributes For Images Nivo-Slider Automatically Adds #408

Open
Jennnnn2 opened this issue Apr 6, 2018 · 6 comments
Open

Missing Alt Attributes For Images Nivo-Slider Automatically Adds #408

Jennnnn2 opened this issue Apr 6, 2018 · 6 comments

Comments

@Jennnnn2
Copy link

Jennnnn2 commented Apr 6, 2018

When I run a site audit with Google Lighthouse the slider image alt tags are missing (I receive an error in GL) even though they are included on my html page. Is it possible to add the alt attributes into the image tags nivo-slider automatically adds?

@bantikyan
Copy link

I also had that problem in my website CoolTechUnder.com

As I only worry about Google audit, and I'm ok to have some general alt text for all images, I did only one change in line 79:

// Set first background
        var sliderImg = $('<img/>').addClass('nivo-main-image');
        sliderImg.attr('src', vars.currentImage.attr('src')).show();
        sliderImg.attr('alt', 'main slider'); //This is only code I have added
        slider.append(sliderImg);

In this case I have alt attribute always set.
If you need to have different alt attributes (get them from original img tags), I think you have to add similar code after all src setters.

sliderImg.attr('src', vars.currentImage.attr('src')).show(); // add after all similar codes
sliderImg.attr('alt', vars.currentImage.attr('alt')); //Something like this

Hope this helps

@NeoGiani
Copy link
Contributor

Hello, I made some change in the code to correct this issue #408

@Jennnnn2
Copy link
Author

Jennnnn2 commented Jan 14, 2021 via email

@iam-sysop
Copy link

iam-sysop commented Jan 15, 2021

There is also an updated fork here - I will check to see if this change is applied in there (or add it), along with compatibility fixes for newer jquery - https://github.com/thecarnie/Nivo-Slider-jQuery

@NeoGiani
Copy link
Contributor

Ok, It's not possible to merge on this repo ?
It will be easier for users

@iam-sysop
Copy link

I don't have merge access -- but I see that one of original project leads merged the pull request --

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants