ScrollTop - Animate Function does not work in IE

ScrollTop - Animate Function does not work in IE

I've got this function (throws an error):
  1.     $(function () {
  2.         function scrollToAnchor(aid) {
  3.             var aTag = $("a[name='" + aid + "']");
  4.             $('html,body').animate({ scrollTop: aTag.offset().top }, 100);
  5.         }
I get this error:
JavaScript runtime error: Unable to get property 'top' of undefined or null reference

It seems to work in Chrome, though most of our users are directed to using IE. (errors in v9-11)

I've searched and searched and nothing I've tried works. Anyone know what to change so it will work? 

Uncle D
http://allthingsDotNet.net
http://tumblingdicesoftware.com