Skip to content

Commit

Permalink
Merge pull request #28 from rullzer/wait_for_load
Browse files Browse the repository at this point in the history
Wait for load of script before binding
  • Loading branch information
MorrisJobke committed Mar 25, 2019
2 parents 02f5c05 + d4ee607 commit 58aca24
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jquery.strengthify.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,18 @@
getWrapperFor(elemId).append('<div class="strengthify-tiles"></div>');
}

$elem.parent().on('scroll', drawSelf);

var script = document.createElement("script");
script.src = options.zxcvbn;
if (options.nonce !== null) {
script.setAttribute('nonce', options.nonce);
}
document.head.appendChild(script);

$elem.bind('keyup input change', drawSelf);
script.onload = function() {
$elem.parent().on('scroll', drawSelf);
$elem.bind('keyup input change', drawSelf);
}

document.head.appendChild(script);
};

init.call(this);
Expand Down

0 comments on commit 58aca24

Please sign in to comment.