_this._updateActive();
});
- if (document.readyState === "complete") {
- _this.$element.on({
- 'resizeme.zf.trigger': _this.reflow.bind(_this),
- 'scrollme.zf.trigger': _this._updateActive.bind(_this)
- }).on('click.zf.magellan', 'a[href^="#"]', function(e) {
- e.preventDefault();
- var arrival = this.getAttribute('href');
- _this.scrollToLoc(arrival);
- });
- } else {
- $(window).one('load', function(){
- _this.$element.on({
+ _this.onLoadListener = onLoad($(window), function () {
+ _this.$element
+ .on({
'resizeme.zf.trigger': _this.reflow.bind(_this),
'scrollme.zf.trigger': _this._updateActive.bind(_this)
- }).on('click.zf.magellan', 'a[href^="#"]', function(e) {
+ })
+ .on('click.zf.magellan', 'a[href^="#"]', function (e) {
e.preventDefault();
- var arrival = _this.getAttribute('href');
+ var arrival = this.getAttribute('href');
_this.scrollToLoc(arrival);
});
- });
- }
-
+ });
+
this._deepLinkScroll = function(e) {
if(_this.options.deepLinking) {
_this.scrollToLoc(window.location.hash);