Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

can i cycle through bg images in a div with jquery ?

Options
  • 22-07-2008 4:33pm
    #1
    Registered Users Posts: 872 ✭✭✭


    Hi,

    I have been using the jquery image cycle plugin alot recently but now i need to cycle through bg images instead of images inside a div.

    I am wondering has someone come across some easy jquery logic to cycle through bg images, i could change the css to change the image but how could i fade it ?

    Thanks for any info


Comments

  • Registered Users Posts: 3,594 ✭✭✭forbairt


    what about having a div with a higher z-index which fades into a color ... in the mean time you replace your background image and ... the higher z-index color fades to transparent showing the new image ?


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    forbairt wrote: »
    what about having a div with a higher z-index which fades into a color ... in the mean time you replace your background image and ... the higher z-index color fades to transparent showing the new image ?

    Smoothest method:

    Have 2 overlapping divs, one with opacity 0.0 and one with opacity 1.0
    Load the background image for each, then fade one out using jQuery and fade the other in

    Repeat, alternating the target div between the two

    The other way is to do a simple jQuery fadeOut and fadeIn on a single div, so that the div fades to the colour of whatever is "behind" it (page background colour or other parent tag)


Advertisement