diff --git a/js/ext/angular/src/service/delegates/ionicScrollDelegate.js b/js/ext/angular/src/service/delegates/ionicScrollDelegate.js
index 22b0cb2abd..e21bed4b47 100644
--- a/js/ext/angular/src/service/delegates/ionicScrollDelegate.js
+++ b/js/ext/angular/src/service/delegates/ionicScrollDelegate.js
@@ -84,7 +84,7 @@ angular.module('ionic.ui.service.scrollDelegate', [])
var hash = $location.hash();
var elm;
//If there are multiple with this id, go to first one
- if (hash && (elm = $document.body.querySelectorAll('#' + hash)[0])) {
+ if (hash && (elm = scrollEl.querySelectorAll('#' + hash)[0])) {
var scroll = ionic.DomUtil.getPositionInParent(elm, scrollEl);
scrollView.scrollTo(scroll.left, scroll.top);
} else {
diff --git a/js/ext/angular/test/anchorScroll.html b/js/ext/angular/test/anchorScroll.html
new file mode 100644
index 0000000000..037cda4a6e
--- /dev/null
+++ b/js/ext/angular/test/anchorScroll.html
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Click me!
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+
+ Here you are.
+
+
+
+
+
+
+
+
diff --git a/js/ext/angular/test/service/delegates/ionicScrollDelegate.unit.js b/js/ext/angular/test/service/delegates/ionicScrollDelegate.unit.js
index 67e00ee0b7..07c060147a 100644
--- a/js/ext/angular/test/service/delegates/ionicScrollDelegate.unit.js
+++ b/js/ext/angular/test/service/delegates/ionicScrollDelegate.unit.js
@@ -98,8 +98,7 @@ describe('anchorScroll', function() {
contentEl = $compile('')(scope);
mockBody = angular.element('').append(contentEl);
- $document.body = mockBody[0];
- del = $ionicScrollDelegate
+ del = $ionicScrollDelegate;
}));
it('should anchorScroll to an element with id', function() {
diff --git a/js/views/scrollView.js b/js/views/scrollView.js
index 5e03e3a8c0..5b6b106f7a 100644
--- a/js/views/scrollView.js
+++ b/js/views/scrollView.js
@@ -292,6 +292,16 @@ ionic.views.Scroll = ionic.views.View.inherit({
this.__container = options.el;
this.__content = options.el.firstElementChild;
+ var self = this;
+
+ //Remove any scrollTop attached to these elements; they are virtual scroll now
+ //This also stops on-load-scroll-to-window.location.hash that the browser does
+ setTimeout(function() {
+ if (self.__container && self.__content) {
+ self.__container.scrollTop = 0;
+ self.__content.scrollTop = 0;
+ }
+ });
this.options = {