gandalf458 wrote:
I'm trying my first simple jQuery task, a mouseover event to display a
box with some text.
$("p.sec-ia").addClass("unhide").show("slow");
works fine but when I add the mouseover
$("#section1").hover(function(){
$("p.sec-ia").addClass("unhide").show("slow");
},function(){
$("p.sec-ia").removeClass("unhide");
});
it doesn't do anything. I don't know if it's because my p.sec-ia isn't
in the #section1. Can anyone give me a clue, please? Thanks.
It would be easier if you could point us to a live page. But there is
something that looks odd. I don't know how the CSS for the class
"unhide" is defined, but you seem to be combining idioms. Usually you
would choose to *either* toggle a CSS class:
$("p.sec-ia").addClass("unhide");
or to directly toggle the visibility:
$("p.sec-ia").show("slow");
Perhaps your hover shouldn't bother (at least at first) with the
"unhide" class but should instead simply do a
$("p.sec-ia").hide(); // or
$("p.sec-ia").fadeIn("slow");
Good luck,
-- Scott