Note that there are some explanatory texts on larger screens.

plurals
  1. POBackground slideshow - Jquery
    text
    copied!<p>I'm trying to create a slideshow that will run in a DIV in the background while having links on top of it. The problem that I'm running into is that when I'm transitioning through pictures using the fadeIn and fadeOut JQuery functions, it is fading out the links as well. Is there a way to fade only the background image? My code is below:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery.js"&gt; var bgimage=new Array() bgimage[0] = 'bg_pic2.jpg'; bgimage[1] = 'bg_pic3.jpg'; bgimage[2] = 'bg_pic4.jpg'; bgimage[3] = 'cbg_pic5.jpg'; bgimage[4] = 'bg_pic1.jpg'; var abc=-1 function t() { if (abc&lt;bgimage.length-1) { abc++; } else { abc=0; } document.getElementById("mainpic").style.backgroundImage = 'url("'+bgimage[abc]+'")'; $('#mainpic').fadeIn(); $('#mainpic').delay(3900).fadeOut(); } window.onload = load; function load() { $('#mainpic').hide(); $('#mainpic').delay(500).fadeIn(); document.getElementById("mainpic").style.backgroundImage = 'url(css/images/bg_pic1.jpg)'; setInterval("t()",5000); //change every 4 seconds, can be changed. $('#mainpic').delay(3600).fadeOut(); } //--&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container" &gt; &lt;div id="mainpic" class="mainpic"&gt; &lt;div style="float:right; height: 531px; width: 20px"&gt;&lt;/div&gt; &lt;br /&gt; &lt;div class="coaches"&gt;&lt;a href=""&gt;&lt;/a&gt;&lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="hours"&gt;&lt;a href=""&gt;&lt;/a&gt;&lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="pics"&gt;&lt;a href=""&gt;&lt;/a&gt;&lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="blog"&gt;&lt;a href=""&gt;&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload