I have an UL
list with several links in it, and each item is linked to its own DIV
. When the user hovers over UL link, proper DIV
box is shown.
Here is my HTML code:
<ul class="productlist">
<li><a href="#" id="link0" class="product-link">Link 1</a></li>
<li><a href="#" id="link2" class="product-link">Link 2</a></li>
<li><a href="#" id="link3" class="product-link">Link 3</a></li>
</ul>
<div class="panel-overview boxlink" id="boxlink0"> Something goes here 1 </div>
<div class="panel-overview boxlink" id="boxlink1"> Something goes here 2 </div>
<div class="panel-overview boxlink" id="boxlink2"> Something goes here 3 </div>
and the JavaScript that makes it work (not a JavaScript expert, sorry):
<script>
$(function() {
var $boxes = $('.boxlink');
$('.productlist .product-link').mouseover(function() {
$boxes.hide().filter('#box' + this.id).show();
});
});
</script>
I was wondering how can I make the boxes to be scrolled through automatically every 3 to 4 seconds. So for example, first DIV
is opened for 3 seconds, then the second, then the third...
Here is the the live site, since I haven't really described it properly.
Here is yet another solution with some
data-target
attributes for pointing content to show/hide.And as usual - a Fiddle, note changes in html.
UPDATE: Your page has an error:
doesnt have
product-link
class. Add that and my solution (and probably other's) will work normal.UPDATE2:
You can replace
With
And it will work without changing html. I've tested this on your actual page.
my solution fiddle
jquery
try it like this:
HTML:
I changed the IDs of the
<a>
s.JS
Working JS Fiddle: http://jsfiddle.net/8527K/
Your description wasn't very clear to me, but this is how I interpereted it after viewing your website: Cycle through the links to show the nice images. This will happen automatically. BUT. If user wants to navigate, the cycle should stop
Here is the code for that.