| View previous topic :: View next topic |
| Author |
Message |
jpainter New member

Joined: 22 Mar 2009 Posts: 1 Location: United States
|
Posted: Sun Mar 22, 2009 9:52 am Post subject: Can you call javascript from the "background-image" |
|
|
The main site page has a banner div with an attached #banner style. Within the div, a portrait photo floats to the far right hand side.
The "background-image" property of the #banner style currently points to scenery.jpg and displays the scenery photo nicely behind the portrait photo.
I have a java script module that will rotate photos for a slide show effect. It works perfectly in a "normal" call.
Is there a way to call this java script routine instead of the .jpg from the "background-image" property of the style?
The goal is to produce a layered effect with a rotating bottom layer. (True layers won't work, as then you lose the ability to center the main container div on the page.)
Can this be done? |
|
| Back to top |
|
 |
sohnee Senior Member

Joined: 17 Jul 2002 Posts: 2077 Location: UK
|
Posted: Thu Apr 09, 2009 12:13 am Post subject: |
|
|
You can change the background image using DHTML - you'd be hard pressed to make a nice transition - just a swap...
| Code: | | document.getElementById("mydiv").style.backgroundImage = "another.jpg"; |
_________________ I also work on... Steve Fenton's Blog and contribute to The Enhance PHP Unit Testing Framework |
|
| Back to top |
|
 |
|