Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit a08249d

Browse files
squash
1 parent d9fc4f6 commit a08249d

File tree

2 files changed

+135
-257
lines changed

2 files changed

+135
-257
lines changed

src/ng/anchorScroll.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -233,23 +233,6 @@ function $AnchorScrollProvider() {
233233
}
234234
}
235235

236-
function scrollWhenReady() {
237-
if (document.readyState === 'complete') {
238-
$rootScope.$evalAsync(scroll);
239-
} else if (!scrollScheduled) {
240-
scrollScheduled = true;
241-
jqLite($window).on('load', function unbindAndScroll() {
242-
// When navigating to a page with a URL including a hash,
243-
// Firefox overwrites our `yOffset` if `$apply()` is used instead.
244-
$rootScope.$evalAsync(function() {
245-
scrollScheduled = false;
246-
jqLite($window).off('load', unbindAndScroll);
247-
scroll();
248-
});
249-
});
250-
}
251-
}
252-
253236
function scroll() {
254237
var hash = $location.hash(), elm;
255238

@@ -274,7 +257,9 @@ function $AnchorScrollProvider() {
274257
// skip the initial scroll if $location.hash is empty
275258
if (newVal === oldVal && newVal === '') return;
276259

277-
scrollWhenReady();
260+
jqLiteDocumentComplete(function() {
261+
$rootScope.$evalAsync(scroll);
262+
});
278263
});
279264
}
280265

0 commit comments

Comments
 (0)