Codeinwp / Nivo-Slider-jQuery

Nivo Slider - The Most Awesome jQuery Image Slider
http://docs.themeisle.com/article/485-getting-started-with-the-nivo-slider-jquery-plugin
MIT License
1.25k stars 605 forks source link

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

Open Jennnnn2 opened 6 years ago

Jennnnn2 commented 6 years ago

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 commented 5 years ago

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 commented 3 years ago

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

Jennnnn2 commented 3 years ago

Thanks!

On Thu, Jan 14, 2021 at 4:56 AM NeoGiani notifications@github.com wrote:

Hello, I made some change in the code to correct this issue #408 https://github.com/Codeinwp/Nivo-Slider-jQuery/issues/408

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Codeinwp/Nivo-Slider-jQuery/issues/408#issuecomment-760088338, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJC2QVO6GDXCPAMOZFX2UIDSZ25WFANCNFSM4EZFPM2A .

-- Jennifer DeRosa Sun Embroidery Screen Printing 1-609-204-9724

iam-sysop commented 3 years ago

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 commented 3 years ago

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

iam-sysop commented 3 years ago

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