www.webdeveloper.com
Results 1 to 4 of 4

Thread: Wordpress Gallery using alt tags as pic captions instead of title tags

  1. #1
    Join Date
    Dec 2012
    Posts
    3

    Wordpress Gallery using alt tags as pic captions instead of title tags

    Okay,here's my challenge. I set up a Next Gen image gallery in Wordpress. When you click on an image it enlarges and has a caption underneath it, which is taken from its title tag. My client doesn't like how when you roll over an image in the gallery a tooltip shows up with the image's descritpion, which is also from the title tag. But he still wants the image description to show up as the caption when you click on the image and enlarge it.

    Here is a link to a page in the site, if you roll over the first image in the gallery, you'll see what I'm talking about and hopefully it'll make sense. http://mbigelowphotographer.com/wp/engagements

    I've tried to find ways on hiding browser default tooltips but I've had no luck. So I thought of placing the image's description in the images alt tag instead of the title tag. Which is fine, I took care of that in the gallery.php file.

    But now I can't figure out where in the java script file,shutter-reloaded.js, for the image caption to pull the alt tag instead of the title tag. I've played around in this file for awhile and I believe that's what controls/triggers it. I can

    I'm hoping its a simple solution that I'm just overlooking since I am only not familiar with javascript.

    Or maybe I'm way off and it's not in that js file. Any help would be appreciated. Thanks in advance.

  2. #2
    Join Date
    Nov 2010
    Posts
    1,029
    it would seem to me that the description gets set here:
    Code:
    NavBar = '<div id="shTitle"><div id="shPrev">' + prevlink + '</div><div id="shNext">' + nextlink + '</div><div id="shName">' + shutterLinks[ln].title + '</div>' + imgNum + '</div>';
    using shutterLinks[ln].title

    and shutterLinks[ln].title gets set here:

    Code:
    T = ( L.title && L.title != shfile ) ? L.title : '';
    so my wild swing at it would be to change that line to

    Code:
    T = ( L.alt && L.alt != shfile ) ? L.alt : '';

  3. #3
    Join Date
    Dec 2012
    Posts
    3
    Thanks for taking a look at it! I tried your suggestion and unfortunately it didn't work.
    It must have something to do with it though. Because when I did make that change the pic caption disappeared all together. It just didn't swap it with the alt.
    So you are probably on to something or pointed in a good direction.

  4. #4
    Join Date
    Dec 2012
    Posts
    3
    Hey xelawho,
    You were right, it had to do with that line of code. Its just that instead of just switching it to alt, I had to add in these two lines of code,

    var linkAlt = jQuery(L).attr('alt');
    T = ( linkAlt && linkAlt != shfile ) ? linkAlt : '';

    (I had this posted on another forum and someone there provided me with this helpful info)

    Thanks again for taking a shot at it. Take care and happy new year.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles