New/Pop/Close
Pop Element๋ฅผ ๋ฑ๋กํ๊ณ ์ด๊ณ ๋ซ์ต๋๋ค.
popman.new({OPTIONS..})
Pop Element๋ฅผ ์ ์ํ์ฌ ๋ฑ๋กํฉ๋๋ค.
โป ์์ฑ
์์ฑ |
ํ์ |
๊ธฐ๋ณธ๊ฐ |
ํน์ง |
id |
String |
{AUTO_GEN} |
Pop Element์ ID |
name |
String |
null |
Pop Element์ Name |
content |
String |
'' |
POP๋
ธ๋๊ฐ ๋ฑ๋ก๋ ๋ |
exp |
String |
50%/50% |
Pop Element์ ์ฌ์ด์ฆ์ ์์น ํํ์ |
expx |
String |
null |
Pop Element์ ๊ฐ๋ก ์ฌ์ด์ฆ์ ์์น ํํ์ |
expy |
String |
null |
Pop Element์ ์ธ๋ก ์ฌ์ด์ฆ์ ์์น ํํ์ |
modeTest |
Boolean |
false |
test๋ฅผ ์ํด CSS ์ค์ ์์ด ๋์ ๋๋ Style์ ์๋ ์ค์ |
modeDark |
Boolean |
true |
๋ฐฐ๊ฒฝ์ ์ด๋์ด ๋ฐํฌ๋ช
์ฒ๋ฆฌํฉ๋๋ค. |
modeAuto |
Boolean |
false |
๋ฑ๋ก๊ณผ ๋์์ Pop Element๋ฅผ ์ฝ๋๋ค. |
modeAnimation |
Boolean |
false |
PopElement๋ฅผ Fade-In/Fade-Out ํจ๊ณผ์ ํจ๊ป ์ด๊ณ ๋ซ์ต๋๋ค. ์ค์ ์ popman.setup({modeAnimation:true}); ๋ ํจ๊ป ์ค์ ํด์ผํฉ๋๋ค. |
closebyclickin |
Boolean |
false |
Pop Element์ ๋ด๋ถ๋ฅผ ํด๋ฆญํ์ ๋ ์ฐฝ์ ๋ซ์ต๋๋ค. |
closebyclickout |
Boolean |
true |
Pop Element์ ์ธ๋ถ(์ด๋์ด ์์ญ)์ ํด๋ฆญํ์ ๋ ์ฐฝ์ ๋ซ์ต๋๋ค. |
closebyesc |
Boolean |
true |
[ESC] ํค๋ฅผ ๋๋ฅผ ๊ฒฝ์ฐ ์ฐฝ์ ๋ซ์ต๋๋ค. |
add |
Function |
null |
๋ฑ๋ก์ ๋ฐ์ํ๋ Event |
pop |
Function |
null |
Pop Element๊ฐ ์ด๋ฆด ๋ ๋ฐ์ํ๋ Event |
afterpop |
Function |
null |
'pop' Event ํ์ ๋ฐ์ํ๋ Event |
close |
Function |
null |
Pop Element๊ฐ ๋ซํ ๋ ๋ฐ์ํ๋ Event |
afterclose |
Function |
null |
'close' Event ํ์ ๋ฐ์ํ๋ Event |
- All Options
<body>
<button onclick="popman.pop('pop-test');">POP</button>
</body>
<script>
popman.new({
id:'pop-test',
name:'some-pop',
content:'Test pop',
exp:'20(*)20/*(50%)',
// expx:'20(*)20',
// expy:'*(50%)',
modeTest:true, //To show you testing example
modeDark:true,
modeAuto:true, //Automatically Pop
modeAnimation:false, //Experimental.. ( If you want to set true, also you needs to popman.setup({modeAnimation:true}) );
closebyclickin:false,
closebyclickout:true,
closebyesc:true,
add:function(data){
//To show you example
data.element.appendChild( document.createElement('input') );
},
pop:function(data){ },
afterPop:function(data){ },
close:function(data){ },
afterClose:function(data){ }
});
</script>
popman.pop(ID or ELEMENT or CONDITION)
๋ฑ๋ก๋ ๋
ธ๋๋ฅผ ํ๋ฉด์ ํ์ํฉ๋๋ค.
popman.new({..})
๋ก ๋ฐํ๋ element๋ก popman.pop(ELEMENT)
ํ๋ฉด popup๋ฉ๋๋ค.
<body>POPMAN TEST - Pop with element</body>
<script>
var newPopNode = popman.new({content: 'NOTICE<br/> Hello popman', modeTest:true});
popman.pop(newPopNode);
</script>
popman.pop(ID)
or popman.pop({PROPERTIES})
<body>
POPMAN TEST - Pop with several ways
<button onclick="popman.pop('pop-test');">Pop with ID</button>
<button onclick="popman.pop({name:'some-pop'});">Pop with name</button>
<button onclick="popman.pop({customTestProp:'*T_00*'});">Pop with Condition</button>
</body>
<script>
popman.new({id:'pop-test', name:'some-pop', customTestProp:'TEST_001', content: 'NOTICE<br/> Hello popman', modeTest:true});
popman.pop('pop-test');
</script>
popman.popTemp({OPTIONS..})
exp / expx / expy
Pop Element์ ํฌ๊ธฐ์ ์์น๋ฅผ ํน์ ํํ์์ผ๋ก ์ ์ํฉ๋๋ค.
<body>
POPMAN TEST
<button onclick="popman.pop('poptest-1');">POP</button>
</body>
<script>
popman.setup({modeTest:true});
//Pop 1
var newPopNode = popman.new({
id: 'poptest-1',
exp: '200/100', // Width:200px, Height:100px
// expx: 200, // Width:200px
// expy: 100, // Height:100px
content: 'NOTICE<br/> Hello popman',
modeAuto: true,
add: function(data){
var buttonToPop2 = document.createElement('button');
buttonToPop2.innerHTML = 'POP2';
buttonToPop2.onclick = function(){ popman.pop('poptest-2'); };
data.element.appendChild(buttonToPop2);
}
});
//Pop 2
var newPopNode2 = popman.new({
id: 'poptest-2',
exp: '100/40%', // Width:100px, Height:40%
// expx: 100, // Width:100px
// expy: '40%', // Height:40%
content: 'Hello again ~'
});
</script>
<body>
POPMAN TEST
<button onclick="popman.pop('poptest');">POP</button>
</body>
<script>
popman.new({
id: 'poptest',
expx: '10(200)', //์ผ์ชฝ 10px ๋๊ณ , 200px์ ํฌ๊ธฐ๋ก ์ค์
expy: '*(50%)10', //์ค๋ฅธ์ชฝ 10px ๋๊ณ , 50%์ ํฌ๊ธฐ๋ก ์ค์
content: 'NOTICE<br/> Hello popman',
modeTest:true,
modeAuto:true
});
</script>
closeby...
- ์ฝ๊ฒ ๋
ธ๋๋ฅผ ๋ซ์ ์ ์๋๋ก ์ต์
์ ์ค์ ํ ์ ์์ต๋๋ค.
<body>
POPMAN TEST
<button onclick="popman.pop('poptest');">POP</button>
</body>
<script>
popman.new({
id: 'poptest',
exp: '70%',
closebyclickin: false, //Click inside of pop element to close
closebyclickout: true, //Click outisde of pop element to close
closebyesc: true, //Press [ESC] button to close
content: 'NOTICE<br/> Hello popman',
modeTest: true
});
popman.pop('poptest');
</script>
popman.close(ID or ELEMENT or CONDITION)
- ํน์ Pop Element๋ฅผ ๋ซ์ต๋๋ค.
<body>
POPMAN TEST
<button onclick="popman.pop('poptest');">POP</button>
</body>
<script>
popman.new({
id: 'poptest',
content: 'NOTICE<br/> Hello popman',
modeTest: true,
modeAuto: true,
add: function(data){
var buttonToClose = document.createElement('button');
buttonToClose.innerHTML = 'Close this pop';
buttonToClose.onclick = function(){ popman.close('poptest'); };
data.element.appendChild(buttonToClose);
}
});
</script>
popman.closeAll()
์ด๋ ค์๋ ๋ชจ๋ Pop Element๋ฅผ ๋ซ์ต๋๋ค.
<body>
POPMAN TEST
<button onclick="popman.pop('poptest-1');">POP</button>
</body>
<script>
popman.new({
id: 'poptest-1',
content: 'Hello popman -1',
modeTest: true,
modeAuto: true,
add: function(data){
var buttonToPop2 = document.createElement('button');
buttonToPop2.innerHTML = 'Pop 2';
buttonToPop2.onclick = function(){ popman.pop('poptest-2'); };
data.element.appendChild(buttonToPop2);
}
});
popman.new({
id: 'poptest-2',
content: 'Hello popman - 2',
exp: '40%',
closebyclickin: false, //Click inside of pop element to close
closebyclickout: false, //Click outisde of pop element to close
closebyesc: false, //Press [ESC] button to close
modeTest: true,
modeAuto: true,
add: function(data){
var buttonToClose = document.createElement('button');
buttonToClose.innerHTML = 'Close this pop';
buttonToClose.onclick = function(){ popman.close('poptest-2'); };
data.element.appendChild(buttonToClose);
var buttonToCloseAll = document.createElement('button');
buttonToCloseAll.innerHTML = 'Close All';
buttonToCloseAll.onclick = function(){ popman.closeAll(); };
data.element.appendChild(buttonToCloseAll);
}
});
</script>