0

I have a simple jquery slideshow that should start when my homepage is loaded. It works, but only after I refresh the page once or twice. Here is the code I am using:

    <!-- include jQuery library -->
<script type="text/javascript" src="js/javascript.js"></script>
    <!-- include Cycle plugin -->
<script type="text/javascript" src="js/Jquery2.js"></script>
<script type="text/javascript">
$(document).ready(function() { 
    $('.image').cycle({
          fx: 'fade',
          random: '1'
          });});      
</script>

Any help would be greatly appreciated! Thanks in advance!!

-Theo

user2124901
  • 1
  • 1
  • 1

2 Answers2

1

Change

<script type="text/javascript">
$(document).ready(function() { 
$('.image').cycle({
      fx: 'fade',
      random: '1'
      });});      
</script>

With

<script type="text/javascript">
$(window).load(function() { 
$('.image').cycle({
      fx: 'fade',
      random: '1'
      });});      
</script>
Alqin
  • 1,305
  • 3
  • 16
  • 35
0

I think all images is not loaded

$('img').load(function() {
    $('.image').cycle({
          fx: 'fade',
          random: '1'
          });});      
});

Read more : Check if images are loaded?

Community
  • 1
  • 1
d.danailov
  • 9,594
  • 4
  • 51
  • 36