From: Scott Worley Date: Fri, 28 Feb 2014 21:42:59 +0000 (-0800) Subject: Reduce jank X-Git-Url: http://git.scottworley.com/picsort/commitdiff_plain/6219f116f895c5aedd312eb2f6f839be2a031d97?ds=sidebyside;hp=59a0fba182b1c592474e3c3c01730917b51828ea Reduce jank This does not completely eliminate the jank. :( --- diff --git a/picsorter.js b/picsorter.js index 24cc893..fd8a8dc 100644 --- a/picsorter.js +++ b/picsorter.js @@ -41,11 +41,13 @@ function setpic() { display_filename = zoom + files[input_index]; } var $pic = $("#pic"); + $pic.on("load", function() { + $pic.removeClass("rot90 rot180 rot270"); + if ("rotate" in picinfo[files[input_index]]) { + $pic.addClass("rot" + picinfo[files[input_index]].rotate); + } + }); $pic.attr("src", display_filename); - $pic.removeClass("rot90 rot180 rot270"); - if ("rotate" in picinfo[files[input_index]]) { - $pic.addClass("rot" + picinfo[files[input_index]].rotate); - } } function say(message) {