On Nov 1, 2009, at 1:33 AM, jmatthews wrote:
Nope. I know what I want, but not what I'm doing.
What is the proper syntax to make the mouseover() below only take
effect on the parent BUT NOT ITS CHILDREN?
$(".House,.Senate,.Assembly").mouseover(function()
You're making it pretty difficult for people to help you. You've
started a few threads asking the same basic question.
http://groups.google.com/group/jquery-en/browse_thread/thread/1745f6b53b65582b/
http://groups.google.com/group/jquery-en/browse_thread/thread/1ddb82c54ad424bf/
http://groups.google.com/group/jquery-en/browse_thread/thread/e86b4b62d0a86590/
And you have replied to earlier posts without providing any context
for that reply.
Have you taken a look at the demo I put up on jsbin.com?
http://jsbin.com/enero/edit
Doesn't that do what you want it to do? And if not, can you describe
how it's different from what you want?
You're fighting against two principles: event bubbling and style
cascading. You can limit the event to be triggered only on those top-
level items, but if you're directly applying a style to those top-
level items, the child elements are also going to receive the styles
because of the cascade, unless their styles are explicitly set to
something different. I already showed one way to get around the
cascade problem in my jsbin demo. Here is a way to limit the triggering:
$(".House,.Senate,.Assembly").mouseover(function(event) {
if (event.target == this) {
// do something
}
}).mouseout(function(event) {
if (event.target == this) {
// do something else
}
});
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com