Javascript Webkit/Html通知的跨浏览器替代方案
在jquery/css中,什么是Webkit/Html通知的跨浏览器替代方案。我基本上想要一些可以从页面右下角弹出的东西,比如webkit通知Javascript Webkit/Html通知的跨浏览器替代方案,javascript,jquery,css,html,Javascript,Jquery,Css,Html,在jquery/css中,什么是Webkit/Html通知的跨浏览器替代方案。我基本上想要一些可以从页面右下角弹出的东西,比如webkit通知 function notify(msg, delay) { var box = document.createElement('DIV'); box.id = 'notification'; // you should just style #notification in css, but w/e box.style.p
function notify(msg, delay) {
var box = document.createElement('DIV');
box.id = 'notification';
// you should just style #notification in css, but w/e
box.style.position = 'fixed';
box.style.bottom = '10px';
box.style.right = '10px';
box.style.width = '200px';
box.innerHTML = msg;
document.body.appendChild(box);
setTimeout(function() {
box.parentNode.removeChild(box);
}, delay);
}
像这样使用它:
notify('sup dude', 1000);
编辑:Jquery版本:
function notifyJquery(msg, delay) {
$("body").append('<div id="notification" />').css({
'display': 'none',
'position': 'fixed',
'bottom': '10px',
'right': '10px'
}).text(msg).fadeIn(400).delay(delay).fadeOut(400);
}
notifyJquery('sup dude', 1000);
函数notifyJquery(消息,延迟){
$(“正文”).append(“”).css({
“显示”:“无”,
'位置':'固定',
“底部”:“10px”,
“右”:“10px”
}).text(msg).fadeIn(400).delay(delay).fadeOut(400);
}
notifyJquery('sup dude',1000);
像这样使用它:
notify('sup dude', 1000);
编辑:Jquery版本:
function notifyJquery(msg, delay) {
$("body").append('<div id="notification" />').css({
'display': 'none',
'position': 'fixed',
'bottom': '10px',
'right': '10px'
}).text(msg).fadeIn(400).delay(delay).fadeOut(400);
}
notifyJquery('sup dude', 1000);
函数notifyJquery(消息,延迟){
$(“正文”).append(“”).css({
“显示”:“无”,
'位置':'固定',
“底部”:“10px”,
“右”:“10px”
}).text(msg).fadeIn(400).delay(delay).fadeOut(400);
}
notifyJquery('sup dude',1000);
这里有一个小演示,可能会给你一些想法
演示:
基本上,我正在使用一个
fixed
positiondiv
创建一个小框,该框由某个事件触发(在本例中单击)滑入页面的视图中。下面是一个小演示,可能会给您一些想法
演示:
基本上,我使用一个
fixed
positiondiv
来创建一个小框,该框由某个事件触发(在本例中单击)滑入页面的视图中。从页面的右下角还是从桌面的右下角?您实际上是在谈论HTML5通知,如中所述?我指的是页面/浏览器的右下角。我不认为第二个是可能的从页面的右下角还是从桌面的右下角?您实际上是在谈论HTML5通知,如中所述?我指的是页面/浏览器的右下角。“咆哮式”解决方案的问题在于,当用户使用另一个(可能是桌面)工具并具有非侵入性通知时,浏览器处于第二个平面才有真正的用处,而“咆哮式”解决方案的问题才显示在页面内解决方案是,当用户使用另一个(可能是桌面)工具并具有非侵入性通知时,它们仅在页面内显示,而真正有用的是让浏览器位于第二个平面