As per this question, I've used the following code:
$("a.smooth-scroll").click(function(e) {
        e.preventDefault();
        $('html, body').animate({
            scrollTop: $( $.attr(this, 'href') ).offset().top
        }, 1000);
    });
My HTML looks like this:
<a href="#product-list" class="btn btn-default smooth-scroll"><span class="fa fa-list-ul"></span>Full Product List</a>
And the corresponding link:
<a name="product-list"></a>
Yet I get a javascript error:
shop.js:8 Uncaught TypeError: Cannot read property 'top' of undefined
Why is this?
 
     
     
    