views:

4346

answers:

3

Hi guys,

I'm currently using the title attribute of my 'a' tag to show and hide images that correspond with this tag.

However, when you hover on the 'a' there is the annoying title text that pops up.

Can I disable this pop-up text with out completely disabling the title attribute? ANy help is great!

Cheers,

DanC

-----edit------

here is the working code which passes as xhtml strict!!!!

$(document).ready(function(){

$(\"ul.projects li a\").hover(
 function(){

    var largeAlt = $(this).attr(\"class\");

    $(\"ul.image_display li#image_hover img\").attr({ src: largeAlt }); 
    $(\"ul.image_display li#image_hover img\").fadeIn();

},
 function(){

 $(\"ul.image_display li#image_hover img\").attr({ src: \"\" }); 
    $(\"ul.image_display li#image_hover img\").fadeIn();

});

});

+1  A: 

Not really, it's the way the browsers are supposed to behave. If you want to map this data, you might want to establish a Javascript data structure that defines the mappings separately. I'm not sure if there is a good semantic way to establish the relationship.

altCognito
+3  A: 

You can try using your own custom attributes instead of using the "title" attribute.

<a customtagattribute="some value" id="link1" href="#">Linkety!</a>

EDIT: JSON key value pairs can also be used like this -

var links = { "link1": "attribute value 1", "link2": "attribute value 2", ... };
Kirtan
yeah, have just done something similar, cheers for the answer though!
DanC
only problem is that you won't have valid xhtml. If you consider that as a problem that is.
Natrium
yeah have just noticed the lack of validation, must be a work around for this........
DanC
You can use a JSON key value pair instead of attributes if you want valid XHTML. Check the answer for more details.
Kirtan
All good again!! If you put the directory as 'class' it passes, even as xhtml strict
DanC
+1  A: 

What about using the anchor's id property? If the path to the image is included (i.e. characters not allowed in IDs), you could use an AJAX request with the ID to get the actual URL (or the actual image).

OregonGhost