I'm using the following code to send push notifications to the user...
document.triggerNotification = function (type, message) {
jQuery(document.body).append("<div class='push-notification hide push-"+type+"' id='notification'>"+message+"</div>");
jQuery('#notification').show().fadeOut(1200, function () {
jQuery('#notification').remove();
});
}
The problem is that the element is not shown at the bottom right corner of where my screen is currently placed, it's showing at the bottom right corner of where the page originally loaded. I'm using the following CSS:
.push-notification {
background-color: #000;
position: absolute;
right: 20px;
bottom: 20px;
color: #fff;
padding: 15px 15px 15px 30px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-repeat: no-repeat;
background-position: 7px center;
opacity: 0.7;
filter: alpha(opacity=70);
vertical-align: middle;
box-shadow: 4px 4px 4px #000;
-webkit-box-shadow: 4px 4px 4px #000;
-moz-box-shadow: 4px 4px 4px #000;
}
.push-check {
background-image: url(/image/icons/accept.png);
}
.push-x {
background-image: url(/image/icons/accept.png);
}
Ideally, if a user starts scrolling while the message is there it'd be nice of the element could move with it.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…