Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Using jQuery Plugins Introducing jQuery Plugins Exploring Plugin Options

Vlad Legkowski
Vlad Legkowski
9,882 Points

How would I combine left and right slide effect

I added .right and .left classes depending on where you are on site (.active), but not sure what to do next, update object literal?

2 Answers

Lewis Marshall
Lewis Marshall
22,673 Points

I updated the object literal to fade in right when loading the page and fade out left when leaving the page.

$('.animsition').animsition({
    inClass: 'fade-in-right-lg',
    outClass: 'fade-out-left-lg'
});

if you are trying to get certain links to move one way and others to move a different way you would need to provide a conditional statement, something like this and then adjust as necessary:

// this example uses a right fade for the home page and left fades for other 2 pages
if ($(".active").html() == "Home") {
   $(".animsition").animsition({
    inClass     :   'fade-in-right-lg',
    outClass    :   'fade-out-right-lg'
   }); 
} else { 
    $(".animsition").animsition({
        inClass     :   'fade-in-left-lg',
        outClass    :   'fade-out-left-lg'
    });
};