From: Nicolas Coden Date: Fri, 23 Mar 2018 09:08:20 +0000 (+0100) Subject: Merge remote-tracking branch 'zurb/develop' into fix/on-load-listeners X-Git-Tag: v6.6.0~3^2~266^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11077%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Merge remote-tracking branch 'zurb/develop' into fix/on-load-listeners --- dc19acdaad846bb52ad2333aafe06096aec250af diff --cc js/foundation.magellan.js index 001d1dadd,471728804..288729a63 --- a/js/foundation.magellan.js +++ b/js/foundation.magellan.js @@@ -94,19 -93,28 +94,19 @@@ class Magellan extends Plugin _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);