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

Joe Treacy
Joe Treacy
1,555 Points

Calling a Parrallax Slider

I am currently adding in a parralax slider to a website using this website. http://www.dynamicdrive.com/dynamicindex17/parallaxslider/

I am stuck on the bit that says

'To initialize the script to display an instance of Parallax Slider, call new parallaxSlider() in the HEAD section of your page'

I don't know what that means at all. What do I type in the head?

1 Answer

Andrew Shook
Andrew Shook
31,709 Points

Joe, what its actually telling you to do is to embed the JS necessary to initialize the slider in script tags in your html. I would recommend putting it in your app.js or script.js file. The code necessary to initialize the slider only has two required options, the id of the slide show wrapper and an array containing the paths to the images for the buttons. This code should help get you started:

var parallax_slider =n ew parallaxSlider({
    wrapperid: 'ID_OF_WRAPPER_DIV',
        // replace these with the path to the actually arrow images you are using
    navbuttons: ['left.png', 'right.png', 'up.png', 'down.png'], 
});