Hi Newbie Q on jquery how-to
I tried using the forum at jquery.com - but it was impossible to register - kept ending up at the Zoho site?
Anyway I am happy to have found this site - which I think does offer help for jquery?
What I would like to accomplish is have each header on my site display a different image that fades In.
So (for testing purposes I am only using 2 images) in the html I assigned a class for each img (headerOne and headerTwo)
My problem is in telling jquery to find the css for headerOne and Two and apply the css before running the fadeIn on the image.
Here is the (pitiful) code I have so far:
<div id="headerImage" class="headerOne"></div>
and the CSS
background: url(../_images/stop_McGinty.png) no-repeat;
I know this is simple but I am so inexperienced in programming and jquery.
Really appreciate any help.
I believe you're looking for something like..
not quite. you need to use a callback
Originally Posted by SamB123
Last edited by DanInMA; 12-11-2011 at 12:51 PM.
Most likely you don't want to fadeOut completely as that will set the element to display: none. Also, you don't need to get headerImage again in the callback, use $(this). I would say this is probably better:
The speed of the transitions is given by 300 in the code above (300ms), if you want to make it faster or slower than change that number. The second number in the fadeTo function is the opacity that it's being faded to.
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)