This is a migrated thread and some comments may be shown as answers.

how to Close radWindow by clicking outside of it

1 Answer 263 Views
Window
This is a migrated thread and some comments may be shown as answers.
Maruthi
Top achievements
Rank 1
Maruthi asked on 20 Jul 2012, 08:18 AM
On click of ContactUs i am calling OpenVideoContactForm(this) 

<script type="text/javascript">
function OpenVideoContactForm() 
{
var oWnd = radopen('/_layouts/ContactUsPopupBranding/ContactUs.aspx','miniRadWindow');
oWnd.setSize(500,550);
} 
</.script>


<td class="globalLogin" onclick="OpenVideoContactForm();">Contact us</td>

The form is opening fine 
but
on mouse click outside the form i should close the form.

Can anyone tell me how to achieve this?



1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Jul 2012, 10:36 AM
Hello,

Try the following javascript to close the RadWindow on clicking outside.
aspx:
<td class="globalLogin" onclick="OpenVideoContactForm(this); return false;">Contact us</td>
JS:
<script type="text/javascript">
function pageLoad()
{
  $addHandler(document, "click", onClickHandler);
}
 var lastOpenedWindow;
 var clickedtd;
 function OpenVideoContactForm(td)
 {
   clickedtd = td;
   var oWindow = radopen('/_layouts/ContactUsPopupBranding/ContactUs.aspx','miniRadWindow');
   lastOpenedWindow = oWindow;
 }
 function onClickHandler(e)
 {
  var targedNodeName = e.target;
  if (lastOpenedWindow && (targedNodeName != clickedtd))
 {
   // If the RadWindow is clicked then do nothing ;
    if ($telerik.isMouseOverElementEx(lastOpenedWindow.get_popupElement(), e)) return;
    lastOpenedWindow.close();
    lastOpenedWindow = null;
    clickedtd = null;
  }
}
</script>

Thanks,
Princy.
Tags
Window
Asked by
Maruthi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or