[Wsuug] JavaScript Rollovers and New Window Done Right?
Zach Young
young.zach at gmail.com
Wed Apr 2 10:37:05 EDT 2008
> The one thing I really
> don't like is the class="rollover". That class name adds no semantic value,
> meaning that we have removed one non-semantic element (the image) and
> replaced it with another (a useless class). I would remove the class from
> the links and force the javascript to work a little harder by basing it's
> work off the closest id (the ul, in this case).
I was thinking about that. Either way could work really. It's just a
different selector. But for now at least I opted for a more general
solution that doesn't depend at all on the markup of the site.
New windows:
I agree new windows are bad generally, but we all have to do them
sometimes (like you said.) I'm not planning on using that one much,
but I'd like to have it around if I needed it.
> I still see rollovers as presentational, not behavioral,
> and thus fall into the field of CSS over Javascript in my mind.
It all depends on where the line is. While CSS is better for
presentation, there are times when presentation must be handled in
JavaScript (for special onclick actions, etc.) This problem could be
solved either way, and both have their advantages and disadvantages.
The things I like about the JavaScript solution are that it keeps the
images out of the way and keeps the markup clean. I'll have to think
about this some more.
Thanks for the input guys.
--
zach
zachyoung.org
More information about the Wsuug
mailing list