首页 > nw.js中有frameset,怎么让-webkit-app-region:drag生效?

nw.js中有frameset,怎么让-webkit-app-region:drag生效?

新手,开始学习用nw.js。

在index.html里使用了frameset,frameset里有一个框架是toolbar.html,用来实现一些功能。现在想让toolbar实现拖曳功能,在toolbar的head里使用<style> .navbar{-webkit-app-region:drag;}</style>没有效果,如果不用frameset是可以实现拖曳效果的。

不知道怎么实现frameset的拖曳功能,请大家帮忙,谢谢!

index.html:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>Editor</title>
        <script type="text/javascript" src="../js/jquery-2.1.4.min.js"></script>
    </head>

    <frameset border="0px" rows="50,*">
        <frame src="./toolbar.html" frameborder=0 noresize marginwidth=0 marginheight=0>
        <frameset border="3px" cols="50%,50%">
            <frame src="./editor.html" frameborder=0 marginwidth=0 marginheight=0>
            <frame src="./result.html" frameborder=0 marginwidth=0 marginheight=0>
        </frameset>
    </frameset>

</html>

toolbar.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>FatCat Editor</title>
        <style>
            .navbar{
                 -webkit-app-region: drag;
            }
        </style>
    </head>
    <body class="toolbar">
        <nav class="navbar">
            <i>LOGO</i>
            <i>保存草稿</i>
            <i>保存md</i>
            <i>导出html</i>
            <i>导出pdf</i>
            <i>删除草稿</i>
        </nav>
    </body>
</html>

package.json

{    
    "main": "index.html",
    "name": "example",    
    "window":
    {        
         "toolbar": false,        
         "frame"  : 'none'
    }
}

-webkit-app-region:drag; 只会监听window.top 下的;

而且不建议使用 frameset、iframe;
对内存的垃圾回收有问题的,https://github.com/nwjs/nw.js/issues/3691

如果你一定要用frameset,只需要在最外层 index.html 加个div,用它来触发拖拽 就可以了;

【热门文章】
【热门文章】