终于得到了我需要的东西。
Sófka 你在我的路上帮助了我。谢谢。这是我需要的。哦,我为此使用了 Orbit 图像滑块。
以下代码适用于我:
(function($) {
$(document).ready(function() {
$('#featured').orbit({
animation: 'fade', // fade, horizontal-slide, vertical-slide, horizontal-push
animationSpeed: 500, // how fast animtions are
timer: true, // true or false to have the timer
advanceSpeed: 6000, // if timer is enabled, time between transitions
pauseOnHover: true, // if you hover pauses the slider
startClockOnMouseOut: true, // if clock should start on MouseOut
startClockOnMouseOutAfter: 0, // how long after MouseOut should the timer start again
directionalNav: false, // manual advancing directional navs
captions: false, // do you want captions?
captionAnimation: 'fade', // fade, slideOpen, none
captionAnimationSpeed: 800, // if so how quickly should they animate in
bullets: false, // true or false to activate the bullet navigation
bulletThumbs: false, // thumbnails for the bullets
bulletThumbLocation: '', // location from this file where thumbs will be
beforeSlideChange: function() {
$('#featured a, #featured span').fadeOut(400, function() {
$('#featured a, #featured span').remove();
});
$('#featured img').each(function(index) {
if ($('#featured img').eq(index).css("z-index") == 3) {
var className = $('#featured img').eq(index).attr("class");
$('#featured img')
.eq($('#featured img').index(this))
.after($('#featured-images .' + className)
.clone()
.css("z-index","4")
);
$('#featured a.' + className)
.css("top",$("#featured img." + className).height() - $("#featured img." + className).next("a").height() - 50)
.css("left",$("#featured img." + className).width() - $("#featured img." + className).next("a").width() - 50)
.fadeIn(1000, function() {
$('#featured a.' + className + ' img').fadeIn(1500);
$('#featured img')
.eq($('#featured img').index(this))
.after($('#featured-text .' + className)
.clone()
.css({"z-index":"4",
"top":"0px",
"display":"block",
"opacity":0,
"position":"absolute",
"left":$("#featured img." + className).width() - $("#featured img." + className).next("a").width() - 70 - $('#featured-text .' + className).width()})
);
$('#featured span.' + className).animate({
opacity: 1,
top: $("#featured img." + className).height() - $("#featured img." + className).next("a").height() - 25
}, 1000);
});
}
});
}
});
});
}(jQuery));
需要自己向代码库添加一些事件挂钩,但这并不太难。
HTML:
<div id="featured">
<img src="http://localhost/foo/images/bar.png" class="image-1" width="924" height="317" alt="" />
<img src="http://img265.imageshack.us/img265/3355/62320763.jpg" class="image-2" width="924" height="317" alt="" />
<img src="http://img411.imageshack.us/img411/1237/75707805.jpg" class="image-3" width="924" height="317" alt="" />
</div>
<div id="featured-images">
<a href="" class="image-1" style="width:100px;height:50px;border:1px solid #FFF;"><img src="http://localhost/foo/images/foobar.png" width="100" height="50" alt="" style="display:none" /></a>
</div>
<div id="featured-text">
<span class="image-1" style="display:none;font-size:30px;color:#FFF;">Dit is een test</span>
</div>