通知 JS 在固定元素上无法正常工作?
Notify JS not working correctly on fixed elements?
问题:如果我在固定元素上启动通知 JS,通知的行为就好像该元素是使用绝对定位放置的一样。
代码参考:
HTML:
<div class="box"></div>
CSS:
.box {
width: 10vw;
height: 10vh;
position: fixed;
top: 2vh;
border: solid 2px;
}
Javascript:
$(".box").notify("Click me!",{position:"bottom center",className:"success"});
JS Fiddle: https://jsfiddle.net/kwzL4999/
复制说明:向下滚动一点并单击元素以查看上述问题的实际效果。
另一种方法是使用 div 和 class 例如 "notify"
在你的 div 和 class "Box"
HTML
<div class="box">
<div class="notify"></div>
</div>
Javascript
$(".notify").on("click",function(){
$(this).notify("Click me!",{position:"bottom center",className:"success"});
});
Jsfiddle 示例:Jsfiddle
问题:如果我在固定元素上启动通知 JS,通知的行为就好像该元素是使用绝对定位放置的一样。
代码参考:
HTML:
<div class="box"></div>
CSS:
.box {
width: 10vw;
height: 10vh;
position: fixed;
top: 2vh;
border: solid 2px;
}
Javascript:
$(".box").notify("Click me!",{position:"bottom center",className:"success"});
JS Fiddle: https://jsfiddle.net/kwzL4999/
复制说明:向下滚动一点并单击元素以查看上述问题的实际效果。
另一种方法是使用 div 和 class 例如 "notify"
在你的 div 和 class "Box"
HTML
<div class="box">
<div class="notify"></div>
</div>
Javascript
$(".notify").on("click",function(){
$(this).notify("Click me!",{position:"bottom center",className:"success"});
});
Jsfiddle 示例:Jsfiddle