Skip to content

Commit

Permalink
Wrap call to init() in a load event listener
Browse files Browse the repository at this point in the history
This _seems_ to work quite well with images (and presumably with other variable height block-level content.) However, all content is visible while loading. This could be mitigated by calling `resizeBoxes` inside the load event callback, instead of `init`, but then you force the browser through two rounds of repainting.

I'm going to leave it as is for now.
  • Loading branch information
jedfoster committed Jan 1, 2015
1 parent fdb3d29 commit 5a1692e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion readmore.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
}

function Readmore( element, options ) {
var $this = this;

this.element = element;

this.options = $.extend( {}, defaults, options);
Expand Down Expand Up @@ -89,7 +91,9 @@
this._defaults = defaults;
this._name = readmore;

this.init();
window.addEventListener('load', function(event) {
$this.init();
});
}

Readmore.prototype = {
Expand Down

0 comments on commit 5a1692e

Please sign in to comment.