This could be a simple thing I’m sure…
I’m trying to get the fade to slide:
$slides.eq($btns.index(this)).fadeIn().siblings().hide();
At the moment, it works great with fade, I just need this line tweaked to slide. I’ve done the obvious but I must be doing something with the syntax as it doesn’t work.
Cheers in advance!
//added
var
$btns = $('.btns a'),
$slides = $('.slides > div');
$btns.click(function(){
$(this).addClass('current')
$(this).parent().siblings().find('a').removeClass('current');
$slides.eq($btns.index(this)).fadeIn(function(){ slideIn }).siblings().hide();
return false;
});
$btns.first().click();
<div class="slides">
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
<div>Slide 4</div>
<div>Slide 5</div>
<div>Slide 6</div>
</div>
<ul class="btns">
<li class="one"><a href="#">1</a></li>
<li class="two"><a href="#">2</a></li>
<li class="three"><a href="#">3</a></li>
<li class="four"><a href="#">4</a></li>
<li class="five"><a href="#">5</a></li>
<li class="six"><a href="#">6</a></li>
</ul>
If you want a normal slide, use
.slideUp()and.slideDown(), like this:You can view a demo here
If instead you want a fade + slide type of effect, pass a speed parameter to
.hide()and.show(), like this:You can test that effect here