I want to rotate the background image of the div, which, it seems to me, does not allow me to use the excellant jQuery plugin.
The code below is what I still have, but it does not behave as I would like:
- Reducing the first image
- Sharing photos with a second image until the image is displayed - (this Fade fails in the second image)
- And repeat to infinity ... and beyond.
<script type='text/javascript' src='http://code.jquery.com/jquery-1.5.2.js'></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script> <link rel="stylesheet" type="text/css" href="/css/normalize.css"> <link rel="stylesheet" type="text/css" href="/css/result-light.css"> <style type='text/css'> #mydiv { width: 100%; height: 365px; margin-left: auto; margin-right: auto; position: relative; display: block; background: url(HP_jQuery1.jpg) center top no-repeat; } </style> <script type='text/javascript'> $(window).load(function(){ var firstTime = true; var arr = ["url(HP_jQuery2.jpg)", "url(HP_jQuery3.jpg)"]; (function recurse(counter) { var bgImage = arr[counter]; if (firstTime == false) { $("#mydiv").fadeOut("slow"); $('#mydiv').css('background-image', bgImage); $("#mydiv").fadeIn("slow"); } else { firstTime = false; } delete arr[counter]; arr.push(bgImage); setTimeout(function() { recurse(counter + 1); }, 3600); })(0); }); </script> </head> <body> <div id="mydiv"> </div> </body>
jquery css
Nicholas murray
source share