Automatically Enable Dialog Framework for Hyperlinks
With the inclusion of the new dialog framework in Sharepoint 2010 it is quite easy to create stylish dialog windows that comply to the overall look and feel of your site. As Jomit Vaghela explains in his blog, all you need to do is put the parameter IsDlg=1 in your url and use the SP.UI.ModalDialog.showModalDialog method with that.
Here’s a modified jQuery version of the script that applies the SP.UI.ModalDialog.showModalDialog method to all links within the page that has the parameter IsDlg=1 in their target. Simply copy and paste the following function in your $(document).ready() to see it in action.
EDIT: Juha reported that the function breaks dialog links within a dialog. I modified the script a bit to filter out unwanted hyperlinks. Here’s the updated code:
filter(':not(.ms-dialog a)').
click(function () {
var options = {
url: $(this).attr('href'),
width: $(this).attr('width') ? $(this).attr('width') : 700,
height: $(this).attr('height') ? $(this).attr('height') : 700,
dialogReturnValueCallback: function () {
}
};
SP.UI.ModalDialog.showModalDialog(options);
return false;
});
Whenever you use links like these in your context, the dialog framework will be used to represent them:
And because of the unobtrusive nature of jQuery, the links will act normally if javascript is disabled.
Popularity: 1% [?]
Works like charm…was looking for this solution on so many websites…Thanks a lott!!
I am regular reader, how are you everybody? This paragraph posted at this web
site is in fact pleasant.
Your code is great. I have successfully applied. Thank you
Very good code, thanks!!!
It reveals how nicely you perceive this subject. http://www.partnersairductcleaning.com/beverlyheights33301
You must to visit world best sexy chat platform – W4M in Townsville for your own free hot chat experience with locla ladies!