diff --git a/demoassets/main.js b/demoassets/main.js index 9ed4a1f..0458c94 100644 --- a/demoassets/main.js +++ b/demoassets/main.js @@ -60,7 +60,23 @@ $(function(){ $('#image-diff').html(diffImage); $(diffImage).click(function(){ - window.open(diffImage.src, '_blank'); + var w = window.open("about:blank", "_blank"); + var html = w.document.documentElement; + var body = w.document.body; + + html.style.margin = 0; + html.style.padding = 0; + body.style.margin = 0; + body.style.padding = 0; + + var img = w.document.createElement("img"); + img.src = diffImage.src; + img.alt = "image diff"; + img.style.maxWidth = "100%"; + img.addEventListener("click", function() { + this.style.maxWidth = this.style.maxWidth === "100%" ? "" : "100%"; + }); + body.appendChild(img); }); $('.buttons').show();