Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
WEB: Web Design Forum- TutorialsDreamweaver Forum- TutorialsFlash Forum- TutorialsWeb StreamingTraining

Help with simple jQuery + png image rotator

Cow Forums : Web Design
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Help with simple jQuery + png image rotator
by Clint Milner on Oct 12, 2009 at 3:41:52 pm

Hi guys,

I was hoping that someone might know a trick to make this work.

I've just worked through the Lynda.com jQuery tutorials and I'm trying to add an image rotator to my site.

I've got it to work exactly as it should, but in the tutorial they were using JPEGs, and I'm using PNGs with transparency, so unfortunately the z-sorting can be seen by the user.
http://printing.alpha-duplication.com/business-cards.html

Here's the code:


HTML

<div id="photoShow">

<div class="current">
<img src="image1.png" width="360" height="360" />
</div>
<div>
<img src="image2.png" width="360" height="360" />
</div>
<div>
<img src="image3.png" width="360" height="360" />
</div>
<div>
<img src="image4.png" width="360" height="360" />
</div>
<div>
<img src="image5.png" width="360" height="360" />
</div>

</div>



jQuery

$(function() {
setInterval("rotateImages()", 3000);
});

function rotateImages() {
var oCurPhoto = $("#photoShow div.current");
var oNxtPhoto = oCurPhoto.next();

if (oNxtPhoto.length == 0)
oNxtPhoto = $("#photoShow div:first");

oCurPhoto.removeClass("current").addClass("previous");
oNxtPhoto.css({opacity:0.0}).addClass("current").animate({opacity:1.0}, 1000,
function() {
oCurPhoto.removeClass("previous");
});
}


CSS

#photoShow {
margin: 0px;
padding: 0px;
height: 360px;
width: 360px;
}
#photoShow div {
position:absolute;
z-index:0;
}
#photoShow div.previous {
z-index: 1;
}
#photoShow div.current {
z-index: 2;
}



I'd be greatful for any tricks or advice.

Kind Regards,
Clint

Adobe CS4 Master Suite
Vista Ultimate 64 SP1
Intel Core i7 920 @ 3.60GHz
12 GB DDR3 RAM
NVidia Quadro FX 3700
Matrox RT.X2 LE Capture Card
4 TB RAID 5


Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:




Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]