728x90
๋ฐ์ํ
function alertBox(msg, delay = 3000){
var container = document.createElement('div');
container.setAttribute('class', 'alertBox-container');
container.style.width = '100%';
container.style.height = '100px';
container.style.position = 'fixed';
container.style.bottom = '0';
container.style.display = 'flex';
container.style.justifyContent = 'center';
var box = document.createElement('div');
box.style.width = '350px';
box.style.height = '100px';
box.style.borderRadius = '15px 15px 0 0';
box.style.backgroundColor = 'rgb(254, 253, 255)';
box.style.boxShadow = '1.5px 1px 10px rgba(0, 0, 0, 0.9)'
box.style.display = 'flex';
box.style.justifyContent = 'center';
box.style.alignItems = 'center';
box.style.marginTop = '200px';
box.style.transition = '.5s';
var message = document.createElement('p');
message.innerHTML = msg;
message.style.fontSize = '23px';
message.style.userSelect = 'none';
box.appendChild( message );
container.appendChild( box );
document.body.appendChild( container );
// // ๋ฑ์ฅ
setTimeout( ()=>{
box.style.marginTop = '0';
}, 0 )
// ์ฌ๋ผ์ง
setTimeout( ()=>{
box.style.marginTop = '200px';
setTimeout( ()=>{ container.remove() }, 1000 )
}, delay )
}
alertBox('๋ง๋์ ๋ฐ๊ฐ์ต๋๋ค!', 5000);
728x90
๋ฐ์ํ
'๐ฅ๏ธํ๋ก ํธ์๋ > HTML | CSS | JAVASCRIPT' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์๋ฐ์คํฌ๋ฆฝํธ - ์ฌ์ฉ์ ๊ณ ์ ์ ํ๋กํ ์ฌ์ง(Identicon) (0) | 2022.07.21 |
---|---|
์๋ฐ์คํฌ๋ฆฝํธ - Web Notification API(์๋์ฐ ์๋ ๊ธฐ๋ฅ) (0) | 2022.06.22 |
html - ๊ฐ๋ฐ์ ๋๊ตฌ ๋ง๊ธฐ(์ฌ์ฉํ๊ธฐ ํ๋ค๊ฒ) (0) | 2022.02.24 |
์๋ฐ์คํฌ๋ฆฝํธ - localStorage์ ํด๋์ค ๋ณ์ ์ ์ฅํ๊ธฐ (0) | 2022.02.10 |
์๋ฐ์คํฌ๋ฆฝํธ - canvas base64 ๋ฐ์ดํฐ ์ถ์ถ (0) | 2021.12.08 |