Below is the code that I am currently using to fade in 4 divs with a 2 second interval between each one. I am using this in a BXslider so as the slide slides into view the 4 divs will load. However although it is a very simple piece of coding. It does not fade in any of the divs, they are just there. Can somebody see what I am doing wrong?
Thanks
My Javascript
<script>
$(document).ready(function() {
$('#element1').delay(2000).fadeTo(0, 2000);
$('#element2').delay(4000).fadeTo(0, 2000);
$('#element3').delay(6000).fadeTo(0, 2000);
$('#element4').delay(8000).fadeTo(0, 2000);
});
</script>
My HTML
<ul class="bxslider">
<li style="background-image: url(images/slide1.png);"><div>
<div id="element1" style="margin:200px;">
<h1 style="font-family: 'Lato', sans-serif; color: #FFF;">we are the cambridge graphic design company...</h1>
</div>
<div id="apDiv4"></div>
<div id="element2" style="margin:200px;">
<div id="apDiv3"></div>
<h2 style="font-family: 'Lato', sans-serif; color: #FFF; text-align: right; font-size: 16px;">we design brochures, catalogues, business cards, leaflets, cd covers and much much more. </h2>
</div>
</li>
<li style="background-image: url(images/slide2.png);"><div>
<div id="div1" style="margin:200px;">
<h1 style="font-family: 'Lato', sans-serif; color: #FFF;">...we are the cambridge website design company...</h1>
</div>
<div id="apDiv4"></div>
<div id="div2" style="margin:200px;">
<div id="apDiv3"></div>
<h2 style="font-family: 'Lato', sans-serif; color: #FFF; text-align: right; font-size: 16px;">offering bespoke, creative website design for small and large businesses of all types to help increase sales. </h2>
</div></li>
<li style="background-image: url(images/slide3.png);;"><div>
<div id="div1" style="margin:200px;">
<h1 style="font-family: 'Lato', sans-serif; color: #FFF;">...we are the cambridge budget design company...</h1>
</div>
<div id="apDiv4"></div>
<div id="div2" style="margin:200px;">
<div id="apDiv3"></div>
<h2 style="font-family: 'Lato', sans-serif; color: #FFF; text-align: right; font-size: 16px;">offering budget & templated websites, business rebranding, start up business rebranding and much much more.</h2>
</div></li>
<li style="background-image: url(images/slide4.png);"><div>
<div id="div1" style="margin:200px;">
<h1 style="font-family: 'Lato', sans-serif; color: #FFF;">...we are the cambridge advertising agency...</h1>
</div>
<div id="apDiv4"></div>
<div id="div2" style="margin:200px;">
<div id="apDiv3"></div>
<h2 style="font-family: 'Lato', sans-serif; color: #FFF; text-align: right; font-size: 16px;">we provide 6 month or 12 month advertising schedules as well as one off adverts for many, many businesses.</h2>
</div></li>
<li style="background-image: url(images/slide5.png);"><div>
<div id="div1" style="margin:200px;">
<h1 style="font-family: 'Lato', sans-serif; color: #FFF;">...we are cambridge copy writers...</h1>
</div>
<div id="div2" style="margin:200px;">
<h2 style="font-family: 'Lato', sans-serif; color: #FFF; text-align: right; font-size: 16px;">whether you have an article, a poem or a novel, we will review, edit or write it for you.</h2>
None of the answers so far have helped for some reason :(, I have also just tried this code below but nothing!
$(function() {
$('#div1, #div2, #div3, #div4').each(function(i) {
$(this).delay(i * 2000).fadeIn(1000);
});
});