Multiple sliders on 1 page
Edit: See another problem below...
Hi guys!
I cound't find a suitable content/image slider, so I've made one myself. It works juist the way I want it to, BUT:
I can have only one per page, otherwise they "slide each other"...
I could copy and paste the code, changing the names, but that ain't a nice solution, so I guess they should have ID's or something, but I dont know how to do that...
Thx in advance!
- $(".slide_nav li a").click(function () {
$('.slide_nav li').removeClass('slides_selected');
$(this).parent().addClass('slides_selected');
var slide_nav_item = $(this).attr("rel");
var mymargin = (slide_nav_item * -600) +600;
$(".slides").animate({
opacity: 0.1,
marginLeft: mymargin,
opacity: 1
}, { duration: 600, queue: false });
});
HTML looks like this:
- <div class="slider">
<div class="slide_nav">
<ul>
<li><a href="javascript:void(0);" rel="1">1</a></li>
<li><a href="javascript:void(0);" rel="2">2</a></li>
<li><a href="javascript:void(0);" rel="3">3</a></li>
<li><a href="javascript:void(0);" rel="4">4</a></li>
<li><a href="javascript:void(0);" rel="5">5</a></li>
</ul>
</div>
<div class="slides">
<ul>
<li> Content 1</li>
<li> Content 2</li>
<li> Content 3</li>
<li> Content 4</li>
<li> Content 5</li>
</ul>
</div>
</div>