ALT attribute and description

Sep 11, 2012 at 2:16 PM

In my HTML, I need to write an ALT attribute for every image in the gallery, but I don't necessarily want that ALT attribute to show up as the description for every image in the gallery. Some images will have descriptions and titles, others will not. But all of the images need to have an ALT attribute.

Is there a way to achieve this?

Mar 26, 2013 at 7:27 AM
I have no idea if you're still looking for an answer on this one, but just in case someone has a similar problem...
You can disable the alt tags showing up as a part of the description and just leave the title tags in place should you want to use them.
Open up the jquery.ad-gallery.js file and find the bit dealing with alt tags:
 var desc = false;
          if(thumb.data('ad-desc')) {
            desc = thumb.data('ad-desc');
          } else if(thumb.attr('alt') && thumb.attr('alt').length) {
            desc = thumb.attr('alt');
          };
Then either comment out or delete everything in this block of code after the first line. Mine looks like this:
 var desc = false;
/*
          if(thumb.data('ad-desc')) {
            desc = thumb.data('ad-desc');
          } else if(thumb.attr('alt') && thumb.attr('alt').length) {
            desc = thumb.attr('alt');
          };
*/
The title tag will remain unaffected and so can still be used as a description for individual images.
Leaving some of the alt descriptions in place while removing others is a little beyond my current coding skills though.
Mar 26, 2013 at 1:47 PM
Thanks, RobGPhotoUK. I was able to get ALT and title working the way I wanted by doing this:
      var desc = false;
      if(thumb.data('ad-desc')) {
        desc = thumb.data('ad-desc');
      //} else if(thumb.attr('alt') && thumb.attr('alt').length) {
       // desc = thumb.attr('alt');
      };
I hadn't tried commenting out the whole block. Thanks for the tip.