1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ <!--
5+ JSFrame Examples
6+ Copyright 2007-2019 Tom Misawa, riversun.org@gmail.com
7+ -->
8+ < title > JsFrame.js example</ title >
9+
10+ < meta charset ="utf-8 ">
11+ < meta name ="description " content ="A javascript popup/floating window library. ">
12+
13+ </ head >
14+ < body style ="background: url('http://upload.wikimedia.org/wikipedia/commons/d/d6/Half_Dome_from_Glacier_Point%2C_Yosemite_NP_-_Diliff.jpg') 50% no-repeat fixed; background-size: cover; ">
15+
16+ < div style ="color:#666666 ">
17+ < a href ="https://github.com/riversun/JSFrame.js "> JSFrame.js</ a > Example:preset style 'yosemite'
18+ </ div >
19+ < script src ="../../jsframe.js "> </ script >
20+
21+ < script >
22+ function start ( ) {
23+
24+ const jsFrame = new JSFrame ( ) ;
25+
26+ const frames = [ ] ;
27+ for ( let i = 0 ; i < 3 ; i ++ ) {
28+ const yosemiteStyle = jsFrame . createPresetStyle ( 'yosemite' ) ;
29+ const frame = jsFrame . createFrame ( 20 + 320 * i , 40 , 300 , 200 , yosemiteStyle ) . setTitle ( `Window${ i } ` )
30+ const innerHTML = `<div id="my_element" style="padding:10px;font-size:12px;color:darkgray;">Contents of window${ i } </div>` ;
31+ frame . setHTML ( innerHTML ) ;
32+ frame . setMinFrameSize ( 160 , 100 ) ;
33+ frame . getFrameView ( ) . style . backgroundColor = "rgba(255,255,255,0.9)" ;
34+
35+ frame . on ( 'minimizeButton' , 'click' , ( frm ) => {
36+ console . log ( frm )
37+ const size = frm . getSize ( ) ;
38+ frm . setSize ( size . width - 20 , size . height - 20 ) ;
39+ } ) ;
40+
41+ frame . on ( 'zoomButton' , 'click' , ( frm ) => {
42+ console . log ( frm )
43+ const size = frm . getSize ( ) ;
44+ frm . setSize ( size . width + 20 , size . height + 20 ) ;
45+ } ) ;
46+
47+
48+ frame . show ( ) ;
49+ frames . push ( frame ) ;
50+
51+ }
52+
53+ frames [ 0 ] . requestFocus ( ) ;
54+ }
55+
56+ start ( ) ;
57+ </ script >
58+
59+ </ body >
60+ </ html >
0 commit comments