Browse Source

fit image to maxWidth 100%

When you open image-diff in a new window it defaults to max-width 100%. This feels more natural for looking at large images. Clicking on the image will toggle fitting to the page width or natural size.
pull/132/head
Peter Coles 7 years ago committed by GitHub
parent
commit
c9f6567809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      demoassets/main.js

4
demoassets/main.js

@ -72,6 +72,10 @@ $(function(){
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);
});

Loading…
Cancel
Save