Forum Moderators: not2easy

Message Too Old, No Replies

Is it possible to add javascript to css?

         

swdweb

3:45 pm on Apr 7, 2009 (gmt 0)

10+ Year Member



I know it's possible to add javascript to a css layout, however, is it possible to add a javascript effect, such as a fade, to an image that is in the .css file?

basically, if I have this code:::

<p class="login"><a href="login.html" target="_self"></a></p>

Would I be able to add an effect to the image that's set as the background url in the #footerPan p.login in my style.css?

Thanks

swa66

7:03 pm on Apr 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS transitions might eventually do what you seek, it's likely going to be part of the future CSS3. iow: too soon.

[w3.org...]

Most likely only webkit (the engine under Safari and Chrome) has an implementation of it today.

Lagacy IE versions have some scripting capability in CSS, but Microsoft wisely decided to drop it in IE8, so it's a dead-end at best.

If you want something more globally usable just go the traditional javascript path.

londrum

8:38 pm on Apr 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you could use CSS to swap it out with an animated .gif... but that's getting a bit desperate