Skip to content

Instantly share code, notes, and snippets.

@cathornton
Created August 22, 2013 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cathornton/6303496 to your computer and use it in GitHub Desktop.
Save cathornton/6303496 to your computer and use it in GitHub Desktop.
/* Lightbox Styles */
/* Lightbox for image hyperlinks */
img.ms-rteImage-LightBox {
-ms-name: "LightBox";
width: 12px;
margin:0px !important;
cursor: pointer;
}
/* Lightbox for text hyperlinks */
a.ms-rteElement-LightBox {
-ms-name: "LightBox";
text-decoration:underline;
font-weight:bold;
}
<script type="text/javascript" src="http://sitecollection/Style Library/Scripts/jquery.js"></script>
<script type="text/javascript">
// JQuery snippet for popup box on hyperlinks:
$("a.ms-rteElement-LightBox").click(function(){
SP.UI.ModalDialog.showModalDialog({
url: $(this).attr("href"),
title: $(this).attr("title")
});
return false;
});
// JQuery snippet for popup box on images:
$('img.ms-rteImage-LightBox').on('click',function(){
SP.UI.ModalDialog.showModalDialog({
url: $(this).parent("a").attr("href"),
title: $(this).parent("a").attr("title")
});
return false;
});
</script>
/* CT: this css stylesheet is referenced in v4.master so I have added
the below to fix the MS Modal Dialog on the page 21/08/13 */
.ms-dlgContent {
position:fixed !important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment