From: Nicolas Coden Date: Sat, 16 Jun 2018 08:17:01 +0000 (+0200) Subject: Use pull request #11258 from ncoden/fix/prevent-triggers-utils-to-load-twice for... X-Git-Tag: v6.5.0-rc.1^2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bf11baed59947ad358e2c38b68cac380c850f45;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Use pull request #11258 from ncoden/fix/prevent-triggers-utils-to-load-twice for v6.5.0 4419192c2 fix: prevent to initialize Triggers twice before window is loaded Signed-off-by: Nicolas Coden --- diff --git a/js/foundation.util.triggers.js b/js/foundation.util.triggers.js index 3a21e36f5..55e1fc306 100644 --- a/js/foundation.util.triggers.js +++ b/js/foundation.util.triggers.js @@ -241,17 +241,14 @@ Triggers.Initializers.addGlobalListeners = function() { } -Triggers.init = function($, Foundation) { - if (typeof($.triggersInitialized) === 'undefined') { - let $document = $(document); - - onLoad($(window), function () { +Triggers.init = function ($, Foundation) { + onLoad($(window), function () { + if ($.triggersInitialized !== true) { Triggers.Initializers.addSimpleListeners(); Triggers.Initializers.addGlobalListeners(); - }); - - $.triggersInitialized = true; - } + $.triggersInitialized = true; + } + }); if(Foundation) { Foundation.Triggers = Triggers;