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

Automatically caluclates position relative to the screen

2 Answers 96 Views
Notification
This is a migrated thread and some comments may be shown as answers.
SANDRO
Top achievements
Rank 2
SANDRO asked on 11 Dec 2013, 11:33 AM
Hi! 

Anyone know if I need to specify some property specifies to run the automatic calculation of the position of notifications?
My notifications are on the MasterPage, when I invoke the notification as it overlaps the previous one.
I wish the notifications is displayed as in the example:
http://demos.telerik.com/aspnet-ajax/notification/examples/overview/defaultcs.aspx

thak you.
Sandro Pinheiro.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Dec 2013, 06:09 AM
Hi SANDRO,

In this 'RadNotification - Telerik's ASP.NET Notification' demo, the Offset value of the first RadNotification is calculated in its Client side event 'OnClientShowing'. Then based on the first offset value, the position for the next RadNotification is calculated and set it through set_offsetY() on the 'ClientShowing' event of the second RadNotification. Please take a look into the below code.

JavaScript:
function OnClientShowing(sender, args) {
        if (sender.calculateOffset == false) return;
        for (var i = 0; i < notifications.length; i++) {
            var notification = notifications[i];
            if (sender !== notification && notification.isVisible())
                sender.set_offsetY(sender.get_offsetY() - notification.get_height());
        }
        sender.calculateOffset = false;
    }
 
    function OnClientHidden(sender, args) {
        sender.set_offsetY(-65);
        sender.calculateOffset = true;
    }

You can use the same approach for positioning the RadNotification relative to another RadNotification.
Thanks,
Shinu.
0
SANDRO
Top achievements
Rank 2
answered on 16 Dec 2013, 01:09 PM
Shinu,
Thank you for your help.

Sandro;.
Tags
Notification
Asked by
SANDRO
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
SANDRO
Top achievements
Rank 2
Share this question
or