Thee is one more thing you could try; wrap the images in anchor tags and place a :hover rule on your anchor. This is still semantically more correct than going the JS way. besides, when you
What I was saying earlier about placing the pointer property on the document is that it will not fire on the image, but it will on the document. Then you would have to set the pointer on the document onmouseover of the image, and on mouseout of the image set the cursor back to default. This should do the trick.
First question; why do you also have .css(‘cursor’, ‘hand’) in the first place? Pointer should work for all browsers… And why is the semi-colon missing from the end of that line?
Second question; what errors or warnings do you see when you debug your script
Third question; what happens when you do this.style.cursor = ‘pointer’
Forth question; do you have the same problem on every browser?
These are the first-impression questions I had when first looking at the code…
i wanted to make sure that the .imageholder item was actually triggering the hover event so i changed the line which added the pointer cursor from this:
$(this).css(“cursor”,“pointer”);
to this:
$(this).css(“cursor”,“pointer”).css(“border”, “3px solid #000000”);
and when i test it, as soon as i hover over the panel, i get a 3px black border… so its adding the css but it just wont take the pointer cursor…
they are indeed clickable… this piece of my fader.js code makes them clickable:
function setLinks(){
$(“.fadeWrapper”).click(function(){
var link=$(“.imageHolder”).eq(currentImage).find(“a”).attr(“href”);
if(link!=null){
location.href=link;
}
});
}
whats weird is that when i use firebug to inspect the element and its css it has cursor:pointer attached. but it just doesn’t work. i cant seem to figure out why.
and my apologies but i don’t understand why the cursor:pointer shoudl be attached to the body element. wouldn’t that make a pointer cursor for everything in the document body??
Are these images actually clickable? Maybe there is a layer in front of them, but I have never heard of a JS framework not picking up CSS styles, if your classes and id’s have been properly defined in the CSS. If that is the case, then I strongly suggest you change framework. I say this because you really don’t want to be defining your cursor style outside of CSS.
About your second question, yes, you have to set the pointer on the document element. This is why you need to fire a onmouseover AND a onmouseout event, but both ServerHerder and I agree that this is really not the elegant way of doing things.
I added in the cursor:hand because i have read that older versions of IE need it. i have tried it with just cursor:pointer and with both - neither one works… and good catch on the semicolon - i added that in.
no errors seem to be thrown anywhere in the process which makes it more difficult. using Firefox and firebug it appears as though the cursor styles are actually being added on roll over. and i know the code is firing because at one point i put an alert in there and when i hovered the alert popped up.
i tried replacing $(this).css(“cursor”,“pointer”).css(“cursor”,“hand”); with this.style.cursor = ‘pointer’ and it still didn’t work.
i have experienced the same problem in every browser i have tested in so far (Chrome, Firefox, IE8, IE7)