The sample in this codepen hides the obvious. If you want to use it, a variable in the function must be silenced, or rather commented out:
// var target = document.querySelector(".last");
If the line remains, the function will allways have .last as it's target ... (sic).
After this small revision you can use the function, like this:
// scroll til footer
document.querySelector(".loremHop").addEventListener("click", function(e) {
console.log('klik på: loremHop')
e.preventDefault();
smoothScroll(document.querySelector(".foot"), 500);
});
And now the smooth scroll functions works like a charm.