我正在使用HumaneJs http://wavded.github.com/humane-js/来显示通知。一切正常,除了我似乎无法指定我的通知应该出现的 DIV。此链接中的讨论似乎 https://github.com/wavded/humane-js/pull/32 表明这是可能的,但我无法让它工作
这是我的 HTML 代码
<button id="1">Display default notification</button><br/><br/><br/><br/>
<div id="container">
<button id="2">Display notification inside div</button><br/><br/>
</div>
这是Javascript
/*display notification in default position*/
$("#1").click(function() {
humane.log("Default notification");
});
/*display notification inside div*/
$("#2").click(function() {
var custom = humane.create({container: $("#container")[0]});
custom.log("Notification inside div");
});
我还设置了一个小提琴来演示这个问题
http://jsfiddle.net/ZvCvJ/
单击该按钮似乎每次都会在默认位置(右上角)显示通知,并且我无法在 DIV 中显示通知。任何帮助将不胜感激。
它显示在角落的原因是因为您使用的是默认libnotify
添加baseCls: "humane-bigbox"
,它应该修复它。
http://jsfiddle.net/ThdLC/
Humane 中各个主题的 CSS 看起来不像是考虑了"容器"。另一个明确支持此"容器受限"通知的通知插件是 Noty。http://needim.github.io/noty/#custom-container