Een wilde gok maar het zoiets als volgt moeten worden dan
$(function(){
$('#foto1 img:gt(0)').hide();
setInterval(function(){
$('#foto1 :first-child').fadeOut(300).next('a').find('img').fadeIn(fading).end().appendTo('#foto1');}, 2000);
});
<div id="foto1">
<a class="serie" href="groot/img_8726.jpg"> <img class="serie" src="img_8726.jpg" width="160" height="120" /> </a>
<a class="serie" href="groot/img_8647.jpg"> <img class="serie" src="img_8647.jpg" width="160" height="120" /> </a>
<a class="serie" href="groot/img_8720.jpg"> <img class="serie" src="img_8720.jpg" width="160" height="120" /> </a>
</div>
Link gekopieerd
Dat heb ik geprobeerd, maar werkt niet.
Het probleem zit, denk ik, dat first-child nu niet meer de img is maar de <a>
(én als je het via de <a> pakt moet hij ook de img in die a meenemen... ?
Link gekopieerd
Nou speciaal voor jou :-)
ik heb
hier een demo en een
download gezet van het onderstaande:
Deze laat de foto's netjes in elkaar oversliden.
<!DOCTYPE html>
<html>
<head>
<title>Slider with Fancybox!</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="lib/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="source/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css?v=2.1.5" media="screen" />
<script type="text/javascript">
function slideSwitch() {
var $active = $('#foto1 a.active');
if ( $active.length == 0 ) $active = $('#foto1 a:last');
// use this to pull the images in the order they appear in the markup
var $next = $active.next().length ? $active.next()
: $('#foto1 a:first');
// uncomment the 3 lines below to pull the images in random order
// var $sibs = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length );
// var $next = $( $sibs[ rndNum ] );
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');
});
}
$(document).ready(function() {
// koppel fancybox aan de alle <a> elementen in 'foto1' hebben
$('#foto1 a').fancybox();
setInterval( "slideSwitch()", 5000 );
});
</script>
<style type="text/css">
#foto1 {
position:relative;
height:125px;
}
#foto1 a {
position:absolute;
top:0;
left:0;
z-index:8;
opacity:0.0;
}
#foto1 a.active {
z-index:10;
opacity:1.0;
}
#foto1 a.last-active {
z-index:9;
}
</style>
</head>
<body>
<h1>Slider with Fancybox</h1>
<p>click a image</p>
<div id="foto1">
<a class="active" href="groot/img_8726.jpg"><img src="img_8726.jpg" width="160" height="120" /></a>
<a href="groot/img_8647.jpg"><img src="img_8647.jpg" width="160" height="120" /></a>
<a href="groot/img_8720.jpg"><img src="img_8720.jpg" width="160" height="120" /></a>
</div>
<p><a href="slider with Fancybox.zip">download complete package</a>
</body>
</html>
Link gekopieerd
Hoi Frank,
hartelijk dank !! Dat werkt!
hier ga ik verder mee experimenteren
Link gekopieerd