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
Richard Mockford
3,476 PointsCode Challenge Responsive Slider Plugin - JavaScript Help
Task 3/4 Create a variable called "options" and set the key “animation” to “slide” and the key “navigationControl” to the boolean of “false”
This is my code
{ var options = {navigationControl: false, animation: "slide"}
It' saying Bummer! The variable 'options' is not set. Where am I going wrong
9 Answers
Richard Mockford
3,476 PointsI've worked it out.
Stefan Santana
5,836 PointsI am having the same issue and used the following code:
<script> var options = {navigationControl: false, animation: "slide"); $(".wmuSlider").wmuSlider(options); </script>
What am I doing wrong?
Stefan Santana
5,836 PointsGot it :)
Joe Grable
6,284 Pointshow did you work it out??? I have the same problem!! please help!
Stefan Santana
5,836 PointsHi Joe,
Basically, what I missed was the "}" instead of the ")". Please try:
var options = {navigationControl: false, animation: "slide"}; $(".wmuSlider").wmuSlider(options);
Good luck!
Larry Kasaija
3,081 PointsThanks Stefan, I tried your code 10 hours ago and for some reason it didn't work. After trying everything and not finding success came back copied and pasted your code and it worked. The world of programming!!
Stefan Santana
5,836 PointsYou're welcome Larry!
Glad all worked out. Same here... sometimes a comma or something really small will void the code somehow. Nice when after a while you get through that.
Larry Kasaija
3,081 PointsStefan, Where are you now in your career?
Brock Duncan
23,042 PointsIf you take the time to post "I've worked it out" you could probably spare the extra minute to explain just how you did it! -_-
Please/Thanks
Brock Duncan
23,042 PointsI have:
var options = { animation:"slide", navigationControl:false; };
Brock Duncan
23,042 PointsI had a lone semicolon after "false"..
this is the correct code
var options = { animation:"slide", navigationControl:false };
ninyo
15,367 PointsJust wanted to write this down so i can reiterate what i'm trying to understand, and hopefully it helps in anyway.
first we need to create a variable called options
we need to enter some adjustments to the plugin's keys (separated by commas between each adjustment), which can be called inside {}. I'm assuming that this is an object, since the last couple lessons that had objects in it used {curly braces}
navigationControl is set to false (no quotes for boolean), while animation is set to "slide".
end with ;
then we expect to pass this into the plugin's parameter later on
var options =
{
navigationControl: false,
animation: "slide"
};
Larry Kasaija
3,081 PointsLarry Kasaija
3,081 PointsHi Richard! Please share. I am really stuck on this one.
Larry Kasaija
3,081 PointsLarry Kasaija
3,081 PointsNever mind. Stefan's code helped: var options = {navigationControl: false, animation: "slide"}; $(".wmuSlider").wmuSlider(options); for some reason I tried it before and it didn't work. Tried it again after 10hours and it works, left me puzzled.