Skip to content

Instantly share code, notes, and snippets.

@TinyExplosions
Created March 13, 2015 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TinyExplosions/ea035a7d2f257f367888 to your computer and use it in GitHub Desktop.
Save TinyExplosions/ea035a7d2f257f367888 to your computer and use it in GitHub Desktop.
// Create your new elements all in memory, saves on repaints
var $ul = $('<ul>');
for (var i = 0; i < whatever; i++) {
$ul.append('<li>Dropdown item</li>');
};
//then append to DOM when complete
$(elem).after($ul);
//trigger event, 0 should be enough to do `nextTick` sorta thing.
setTimeout($(elem).triger('dompainted'),0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment