BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi Chong,
Thanks for your update.
We would like to let you know that Dialog popup will be
appeared in the center of the browser window by default. We
have used $(window).scroll() function to set the Dialog popup in fixed
position. The Css property position is used here to set Dialog’s
position. If you set this property as fixed, then Dialog popup will
appear in the middle of the page even you scroll. Refer the below work around to display Dialog popup in center of the browser window.
<script>
$(window).scroll(function () {
$("#dialogposition_wrapper").css({ 'position': 'fixed' });
});
script>
Note: Here dialogposition is Id of the Dialog control
Please find the attached sample.
Regards,
Jaganprakash
Hi Chong,
Thanks for your update.
We have modified the code as per your requirements. We have set the position of the Dialog box with respect to the scroll bar position in positioned() function. Initially Dialog box will be in the middle of the page and the position of the scroll bar is (0,0). Position of the scroll bar is calculated and added with the position of the Dialog while scrolling. Therefore if the page is scrolled, then the Dialog will also be scrolled. We have used position property to set X and Y value to Dialog box. The reported issues are resolved as follows.
Now when you move the Dialog box, then scroll the page, It will automatically appear in the middle of the page. Because positioned() is called inside $(window).scroll() function.
When the page is already scrolled halfway, then the dialog box is triggered to show, X and Y values should be set to Dialog box accordingly. We have used a Button to trigger the Dialog box. Close the Dialog box and click that button to open the Dialog box again. Now it will appear at the middle of the page even the page was scrolled halfway. Because positioned() function is called in the click() function. Refer the following code.
[ASPX]
<ej:Dialog ID="dialogposition" runat="server" Title="Dialog">
<ej:ToggleButton ID="ToggleButton1" runat="server" DefaultText="Dialog" ClientSideOnClick="click">ej:ToggleButton>
<script>
function click() {
var dialogObj = $("#dialogposition").data("ejDialog");
dialogObj.open();
positioned();
}
function positioned() {
var windowpostop = $(window).scrollTop();
var windowposleft = $(window).scrollLeft();
$("#dialogposition").ejDialog({ position: { X: windowposleft + 553, Y: windowpostop + 282 } });
}
$(window).scroll(function () {
positioned();
});
script>
Please find the attached sample.
Regards,
Jaganprakash
Hi Chong Yee Mei
Thanks for the Update.
Please let us know if you have any other
queries.
Regards,
Rajaveni
[ASPX]
<ej:Dialog ID="dialogposition" runat="server" Title="Dialog">
<ej:ToggleButton ID="ToggleButton1" runat="server" DefaultText="Dialog" ClientSideOnClick="click">ej:ToggleButton>
<script>
function click() {
var dialogObj = $("#dialogposition").data("ejDialog");
dialogObj.open();
positioned();
}
function positioned() {
var windowpostop = $(window).scrollTop();
var windowposleft = $(window).scrollLeft();
$("#dialogposition").ejDialog({ position: { X: windowposleft + 553, Y: windowpostop + 282 } });
}
$(window).scroll(function () {
positioned();
});
</script>
my code looks like this.
<div id="userInfoPopup" >
@{Html.EJ().Dialog("ViewUserInfo").Title("Information").Items(data =>
{
data.ContentTemplate(@<div style="margin: 5px 14px;">@Html.Partial("Information/UserInformation")</div>);
}).ShowRoundedCorner(true).ShowOnInit(false).EnableModal(true).EnableResize(false).Width(450).Render();}
</div>