Last active
November 28, 2018 16:17
-
-
Save OlafD/61c6d21b5b9d1ec054002c49e01e3043 to your computer and use it in GitHub Desktop.
Snippet for a SharePoint Script Editor webpart, to show an image and on a click show the image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var dlgOptions; | |
function setDlgOptions(pictureUrl) { | |
var htmlFragment = document.createElement("img"); | |
htmlFragment.setAttribute("src", pictureUrl); | |
htmlFragment.setAttribute("width", "800"); | |
htmlFragment.setAttribute("height", "600"); | |
dlgOptions = { | |
title: "The Image", | |
width: 800, | |
height: 600, | |
html: htmlFragment, | |
showClose: true | |
}; | |
} | |
</script> | |
<img src="https://your-tenant.sharepoint.com/sites/img-tester/Shared%20Documents/Sonnenuntergang_mit_Segelschiff.png" | |
width="400" | |
height="300" | |
onclick="setDlgOptions(this.src); SP.UI.ModalDialog.showModalDialog(dlgOptions);"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment