3 Replies Latest reply on Apr 10, 2008 6:09 AM by Colin Fraser

    Image Rollover / Swap Image... How?

    Colin Fraser Newbie


      Just wondering what the best way to achieve an image rollover for a button is?

      Don't seem to be able to find a component for it... not sure what component/property I should use.

      I see there is one in MyFaces... have not used any MyFaces stuff yet, does it integrate well? Would it be worth adding just to get image rollovers going?

      Thanks for any pointers.


        • 1. Re: Image Rollover / Swap Image... How?
          Sergey Smirnov Master

          it is just a pure client side behaviour. Why you are looking for JSF component that does this simple thing?

          • 3. Re: Image Rollover / Swap Image... How?
            Colin Fraser Newbie

            Why am I looking for a JSF component that does this?

            There are a couple of answers to this...

            1: I am a bit of a newbie at this, and, well, that says a lot :-)

            2: I am using javascript at the moment, and it is a bit ugly... big long onmouse events calling javascript code with image locations and Ids.. then there is the placement of the javascript to consider (see next point).

            3: I am using facelets templating, and in the 'child' component I want to use a rollover image... the current example is for a navigation bar.

            I understand it is best to put JavaScript stuff in the HTML head tag...

            I am not sure yet which pages will have this navigation bar, and often the pages that would have it would be layered quite deep with templates...

            Therefore I don't really know yet which top level templates... the ones with the html and head tags... would be getting rollover images eventually.

            I could go and update all the top level templates to include rollover image functionality, just in case a component might get inserted that may use a rollover images... but it just feels a bit strange doing this.

            Does this make any sense?

            4: I thought the tool tip component was sort of similar... you can get this via client side javascript coding also, but it is much easier to use than with required javascript.

            So there are a couple of reasons why I thought it would be nice if there was an image swap/rollover component (and thought there might be one somewhere that I missed).

            But point 1 really comes into play... I am not really sure on the best way to do things (yet) :-)

            Thanks for the pointers... I am checking out the htmlgoodies to see if it is a bit simpler than the javascript I already have.