我将此应用程序移植到node-webkit,并且我想制作自己的工具栏+关闭按钮。然而,我对css/html的了解并不那么大,而且我也无法弄清楚如何完成这项工作。工具栏与我的按钮重叠
问题是我的工具栏重叠关闭按钮,从而使按钮无法使用。
CSS:
.toolbar{
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 32px;
-webkit-user-select: none;
-webkit-app-region: drag;
background: #776e65;
cursor: pointer; }
button {
-moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
-webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
box-shadow:inset 0px 1px 0px 0px #ffffff;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf));
background:-moz-linear-gradient(center top, #ededed 5%, #dfdfdf 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
background-color:#ededed;
-webkit-border-top-left-radius:6px;
-moz-border-radius-topleft:6px;
border-top-left-radius:6px;
-webkit-border-top-right-radius:6px;
-moz-border-radius-topright:6px;
border-top-right-radius:6px;
-webkit-border-bottom-right-radius:6px;
-moz-border-radius-bottomright:6px;
border-bottom-right-radius:6px;
-webkit-border-bottom-left-radius:6px;
-moz-border-radius-bottomleft:6px;
border-bottom-left-radius:6px;
text-indent:0;
border:1px solid #dcdcdc;
display:inline-block;
color:#777777;
font-family:arial;
font-size:15px;
font-weight:bold;
font-style:normal;
height:30px;
width:30px;
position: fixed;
top: 0;
right: 0;
HTML:
<div class="toolbar">
<button id="close">x</button>
JS:
onload = function() {
var closeNode = document.getElementById('close');
if (closeNode) {
closeNode.onclick = function() {
window.close();
};
}
}
UPD:代码现在工作在浏览器中,而不是内部节点的WebKit -webkit-app-region: no-drag;
也使用。
那样的工作,它创造下的工具栏右下角的可视区域,改变光标,如果点击关闭应用程序。 按钮本身是无形的,而不是定位为意 的是节点的Webkit BTW 这里是整个应用程序的.nw文件只是柜面https://mega.co.nz/#!yMwSHTKI!ge-vbucFPEyz95xbdIT74mGy6IbljlfNODHr -3ISC-M – Konata
@Konata你可以尝试更高的z-index作为按钮。它在jsfiddle中工作,所以你的应用中可能还有其他的东西在调整它。 – zsaat14
它在我在浏览器中打开应用程序时有效,但是当使用node-webkit实例时它不在那里:( – Konata