##// END OF EJS Templates
use on-load event to trigger resizable images...
MinRK -
Show More
@@ -564,15 +564,13 b' var IPython = (function (IPython) {'
564 564
565 565
566 566 OutputArea.prototype._dblclick_to_reset_size = function (img) {
567 // schedule wrapping image in resizable after a delay,
568 // so we don't end up calling resize on a zero-size object
569 var that = this;
570 setTimeout(function () {
567 // wrap image after it's loaded on the page,
568 // otherwise the measured initial size will be incorrect
569 img.on("load", function (){
571 570 var h0 = img.height();
572 571 var w0 = img.width();
573 572 if (!(h0 && w0)) {
574 // zero size, schedule another timeout
575 that._dblclick_to_reset_size(img);
573 // zero size, don't make it resizable
576 574 return;
577 575 }
578 576 img.resizable({
@@ -586,7 +584,7 b' var IPython = (function (IPython) {'
586 584 img.parent().width(w0);
587 585 img.width(w0);
588 586 });
589 }, 250);
587 });
590 588 };
591 589
592 590 var set_width_height = function (img, md, mime) {
General Comments 0
You need to be logged in to leave comments. Login now