Node

package.json:

1{     2    "main": "index.html", 3    "name": "example",     4    "window": 5    {         6         "toolbar": false,         7         "frame"  : false 8    } 9}

index.html:

1<!doctype html><html lang='en'><head> 2    <meta charset='UTF-8'> 3    <title>NodeWebkit Window Controls Example</title> 4    <link rel='stylesheet' href='reset.css'> 5    <link rel='stylesheet' href='style.css'> 6 7    <script> 8 9        var nw = require('nw.gui');        var win = nw.Window.get(); 10        win.isMaximized = false;    </script> 11 12    </head><body> 13 14    <header> 15        <ul> 16            <li><a href='#' title='Minimize' id='windowControlMinimize'></a></li><!-- 17         --><li><a href='#' title='Maximize' id='windowControlMaximize'></a></li><!-- 18         --><li><a href='#' title='Close'    id='windowControlClose'   ></a></li> 19            </ul> 20        </header> 21 22    <script> 23 24        // Min 25        document.getElementById('windowControlMinimize').onclick = function() 26        { 27            win.minimize(); 28        };        // Close 29        document.getElementById('windowControlClose').onclick = function() 30        { 31            win.close(); 32        };        // Max 33        document.getElementById('windowControlMaximize').onclick = function() 34        { 35            if (win.isMaximized) 36                win.unmaximize();            else 37                win.maximize(); 38        }; 39 40        win.on('maximize', function(){ 41            win.isMaximized = true; 42        }); 43 44        win.on('unmaximize', function(){ 45            win.isMaximized = false; 46        });    </script> 47 48    </body></html>

reset.css:

1/** 2 * CSS Reset via http://meyerweb.com/eric/tools/css/reset/ 3 */html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset,form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer,header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video{    margin: 0;padding: 0;border: 0;font-size: 100%; font: inherit;vertical-align: baseline;    }article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section{    display: block;    }body{    line-height: 1;    }ol, ul{    list-style: none;    }blockquote, q {    quotes: none;    }blockquote:before, blockquote:after, q:before, q:after{    content: '';    content: none;    }table{    border-collapse: collapse;    border-spacing:  0;    }a{    text-decoration: none;    }

style.css:

@charset "UTF-8";/*Title Bar*/header{    width:         100%;    height:         34px;    background:    -webkit-linear-gradient(top, rgb(255,255,255) 0, rgb(225,225,225) 100%);    border-bottom: 1px solid rgb(205,205,205);    -webkit-app-region: drag;    -webkit-user-select: none;    }/*Window Controls*/header>ul{    float:        right;    text-align:   right;    line-height:  0;    padding-left: 6px;    }header>ul>li,header>ul>li>a{    display: inline-block;    }header>ul{    float: right;    }header>ul>li>a{    width:              22px;    height:             22px;    margin:              6px 6px 6px 0;    background-image:   url('./icons.svg');    background-repeat:  no-repeat;    -webkit-transition: -webkit-transform 200ms;    -webkit-app-region: no-drag;    }header>ul>li>a:hover,header>ul>li>a:focus{    -webkit-transform:  scale(1.22,1.22);    outline:            none;    }a#windowControlClose{    background-position: -44px 0;    }a#windowControlMaximize{    background-position: -22px 0;    }a#windowControlMinimize{    background-position: 0 0;    }

以上就是简单拖动的例子,文件创建好后,把所有文件拷贝到nwjs 解压目录下,运行nw.exe就可以了

这个例子转自

http://nodehead.com/node-webkit-custom-window-controls-26/

问题:

我们开发时使用的是 node-webkit v0.12.2: (May 22, 2015, based off of IO.js v1.2.0, Chromium 41.0.2272.76) 版本

package.json

1{ 2  "main": "index.html", 3  "name": "example", 4  "window": 5  { 6    "toolbar": false, 7    "frame"  : false, 8    "resizable":false // 不能生效 9  } 10}

使用 node-webkit v0.13.0-alpha2: (Jun 23, 2015, based off of IO.js v1.5.1, Chromium 43.0.2357.45)

 "resizable":false //生效了
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

java将前端的json数组字符串转换为列表

记录下在前端通过ajax提交了一个json数组的字符串,在后端如何转换为列表。前端数据转化与请求varcontracts{id:'1',name:'yanggb合同1'},{id:'2',name:'yanggb合同2'},{id:'3',name:'yang

KVM调整cpu和内存

一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid