Reputation: 44293
hey guys, i just wrote a little function that filters all anchor links and animates a scroll to the found element.
i just wonder if there is anything i could do better? how would you do that? i'm actually quite happy with the solution, however maybe you'll find a rather bad-scripted part right away.
e.g. this part looks rather complicated and i wonder if theres a better way to filter the hashtag out of a href attribute?
anchor = $(this).attr('href').split('#')[1];
thank you for your tipps.
Upvotes: 0
Views: 227
Reputation: 10219
I see 2 things :
I don't think you need .each()
.
I don't think you need to .split()
.
Upvotes: 1