 <p>On this line:</p> <pre><code>scrollLeft: $(anchor.attr('href')).offset().left </code></pre> <p>You mispelled your variable <code>$anchor</code>. Change it to:</p> <pre><code>scrollLeft: $($anchor.attr('href')).offset().left </code></pre> <p>Either way I recommend you to learn how to use the dev-tools of your browser and especially how to use break points so you can check yourself what variable doesn't behave as you would expect.</p>