Advanced Search

Results 1 to 2 of 2

Thread: Javascript vs. CSS for rollovers

  1. #1
    Join Date
    Apr 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Javascript vs. CSS for rollovers

    Hello All:

    Is there any benefit to using javascript vs. css in creating image rollovers. I'm familiar with the benefits of CSS, and would think that would be the preferable approach. I know there are scripts that perform special functions, like fade in/out, but for the run of the mill rollovers, why opt for the many javascripts out there?

    Any feedback?

    Spice
    Last edited by gobayview; 04-24-2005 at 09:29 PM. Reason: Subscribe

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by gobayview
    Is there any benefit to using javascript vs. css in creating image rollovers.
    It should depend on the type of rollover, and what is triggering that rollover. If you really want a CSS rollover effect to work in IE, then obviously you're limited to involving a elements due to IE's poor CSS support. Though scripting doesn't suffer from the problem, users do disable client-side scripting so you're still not likely to achieve complete success.

    It also depends on what exactly the effect is. If you're being kind to your users and displaying marked-up text with a changing background image, or perhaps just colour changes, a couple of simple rules with well-structured documents could apply the effect to an entire site with minimal overhead. However, if you're using text-containing images or icons, you have little option than to use a scripted solution: the images should be img elements so you can specify alternative text, and only a script could modify the source of that element.

    for the run of the mill rollovers, why opt for the many javascripts out there?
    CSS is still a mystery to many amateur authors, and probably some "professionals", too. They'll also like to use pre-built solutions like Macromedia's, despite being badly implemented and difficult to maintain.

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •