User Rating
( vote)
Sharepoint 2010 have a very good featuree of Modal dialog, Modal dialogs in sharepoint 2010 use the client library SP.UI.ModalDialog and showModalDialog
There come the requirement when you want to find the weather the modal dialog is opened or not and you want to modify certain style in modal dialog from the parent page, this can be achieved by using javascript adding it to master page, where you can identify the window location and can create the javascript or style tag that can be add it to modal dialog while rendering.
For example adding the style tag.
<br /> <script type='text/javascript'><br /> var isInIFrame = window.location != window.parent.location;<br /> if (isInIFrame) {<br /> var style = document.createElement('style');<br /> // fileref.setAttribute("rel", "stylesheet")<br /> style.type = 'text/css';<br /> var css = '.PageMainBody{ overflow-y: visible;}';<br /> if (style.styleSheet) {<br /> style.styleSheet.cssText = css;<br /> } else { style.appendChild(document.createTextNode(css)); }<br /> if (typeof style != "undefined")<br /> document.getElementsByTagName("head")[0].appendChild(style)<br /> }<br /> </script><br />
or the same thing can be achieved using
<br /> .ms-dialog .PageMainBody<br /> {<br /> overflow-y: visible;<br /> }<br />
Thanks-