Reputation: 2418
I am creating a web page that uses a horizontal slider and animations to scrollTo hidden divs. When I click home I would like it to go to the first slide-panel div no matter what slide panel or mainContent div it is on. I've been messing around with the scrollTo that simply scrolls up to the slide panel but i cant figure out how to make it go back to the first panel. Any ideas?
$(function() {
$('#contact').click(function() {
$('#contactDiv').show();
$.scrollTo( '#contactDiv', 800, {easing:'swing', offset:{top:-130}} );
if (currPanel != 1)
/*???? idk what to do here but i want it to scroll and slide to the first slide-panel
});
});
please see the jsFiddle for complete code: http://jsfiddle.net/mU9Nu/
Upvotes: 0
Views: 184
Reputation: 6007
Maybe this is a good solution for you:
$('#home').click(function() {
$('.slide-panel').removeClass('active');
$( $('.slide-panel')[0] ).addClass('active');
});
The $( $('.classname')[i] )
is referring to .classname
's like an array.
Upvotes: 1