function () {
      var scrollTop = content.scrollTop;
      var diff = (finalScrollTop - scrollTop);
      if (Math.abs(diff) > 3) {
        content.scrollTop += diff / 3;
        editor.animateCallback = callback;
        editor.animateTimeout = setTimeout(animate, 50);
      }
      else {
        // finished
        if (callback) {
          callback(true);
        }
        content.scrollTop = finalScrollTop;
        delete editor.animateTimeout;
        delete editor.animateCallback;
      }
    }
function () {
      var scrollTop = content.scrollTop;
      var diff = (finalScrollTop - scrollTop);
      if (Math.abs(diff) > 3) {
        content.scrollTop += diff / 3;
        editor.animateCallback = callback;
        editor.animateTimeout = setTimeout(animate, 50);
      }
      else {
        
        if (callback) {
          callback(true);
        }
        content.scrollTop = finalScrollTop;
        delete editor.animateTimeout;
        delete editor.animateCallback;
      }
    }
function ( ) { var scrollTop = content . scrollTop ; var diff = ( finalScrollTop - scrollTop ) ; if ( Math . abs ( diff ) > 3 ) { content . scrollTop += diff / 3 ; editor . animateCallback = callback ; editor . animateTimeout = setTimeout ( animate , 50 ) ; } else { // finished if ( callback ) { callback ( true ) ; } content . scrollTop = finalScrollTop ; delete editor . animateTimeout ; delete editor . animateCallback ; } }
animate towards the new scroll position
animate towards the new scroll position