js+css实现面包吐司右下角弹出层消息代码
代码语言:html
所属分类:弹出层
代码描述:js+css实现面包吐司右下角弹出层消息代码
代码标签: js css 面包 吐司 右下角 弹出层 消息 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> /* Base Styles */ :root { /* Toast Type Colors */ --success-bg: #4CAF50; --success-light: #A5D6A7; --success-dark: #2E7D32; --success-icon: '🍓'; --info-bg: #2196F3; --info-light: #90CAF9; --info-dark: #1565C0; --info-icon: '🧈'; --warning-bg: #FF9800; --warning-light: #FFCC80; --warning-dark: #EF6C00; --warning-icon: '🍯'; --error-bg: #F44336; --error-light: #EF9A9A; --error-dark: #C62828; --error-icon: '🍫'; /* UI Colors */ --bg-color: #FFF9E6; --kitchen-color: #F0E6D2; --counter-color: #D2B48C; --panel-bg: #FFFFFF; --panel-border: #F0E6D2; --text-primary: #3E2723; --text-secondary: #5D4037; --shadow-color: rgba(0, 0, 0, 0.15); /* Toast Colors */ --toast-light: #F5DEB3; --toast-medium: #DEB887; --toast-dark: #CD853F; --toast-burnt: #8B4513; /* Animation Speeds */ --toast-anim-speed: 0.4s; } * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Nunito', sans-serif; } body { background-color: var(--bg-color); min-height: 100vh; padding: 20px; display: flex; flex-direction: column; align-items: center; overflow-x: hidden; } /* Kitchen Scene */ .kitchen-scene { width: 100%; max-width: 800px; height: 200px; margin-bottom: 30px; position: relative; } /* Toast Character */ .toast-character { position: absolute; width: 100px; height: 120px; background: linear-gradient(to bottom right, var(--toast-medium), var(--toast-dark)); border-radius: 10px; bottom: 50px; left: 50px; z-index: 10; cursor: pointer; transition: transform 0.3s ease; transform-origin: bottom center; } .toast-character:hover { transform: rotate(-5deg) translateY(-10px); } .toast-character:active { transform: scale(0.95); } .toast-face { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 20px; } .eyes { display: flex; justify-content: space-around; width: 60%; margin-bottom: 15px; } .eye { width: 15px; height: 20px; background-color: var(--text-primary); border-radius: 50%; position: relative; } .eye::after { content: ''; position: absolute; width: 5px; height: 5px; background-color: white; border-radius: 50%; top: 2px; right: 2px; } .toast-character.wink .eye.right { height: 3px; border-radius: 0; background-color: var(--text-primary); top: 10px; } .mouth { width: 40px; height: 20px; border-radius: 0 0 20px 20px; background-color: var(--text-primary); position: relative; overflow: hidden; } .mouth::after { content: ''; position: absolute; width: 20px; height: 10px; background-color: #FF6B6B; bottom: 0; left: 10px; border-radius: 10px 10px 0 0; } .toast-character.surprised .mouth { height: 25px; width: 25px; border-radius: 50%; } .toast-character.surprised .mouth::after { display: none; } .toast-character.sad .mouth { border-radius: 20px 20px 0 0; transform: rotate(180deg); height: 15px; } .toast-speech-bubble { position: absolute; background-color: white; border-radius: 20px; padding: 10px 15px; top: -60px; left: 50%; transform: translateX(-50%); box-shadow: 0 4px 8px var(--shadow-color); transition: all 0.3s ease; opacity: 1; z-index: 20; pointer-events: none; } .toast-speech-bubble::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 10px solid white; } .toast-speech-bubble p { white-space: nowrap; font-size: 14px; color: var(--text-primary); } .toast-speech-bubble.hidden { opacity: 0; transform: translateX(-50%) translateY(10px); } /* Kitchen Counter */ .kitchen-counter { width: 100%; height: 80px; background-color: var(--counter-color); position: absolute; bottom: 0; border-radius: 10px 10px 0 0; box-shadow: 0 -5px 15px var(--shadow-color); display: flex; justify-content: space-around; align-items: flex-start; padding: 0 20px; } .toaster { width: 120px; height: 70px; background: linear-gradient(to bottom, #E0E0E0, #BDBDBD); border-radius: 10px; position: relative; top: -20px; box-shadow: 0 5px 15px var(--shadow-color); } .toaster-slot { width: 80px; height: 15px; background-color: #424242; position: absolute; top: 10px; left: 20px; border-radius: 5px; } .toaster-lever { width: 10px; height: 30px; background-color: #F5F5F5; position: absolute; right: 15px; top: 20px; border-radius: 5px; cursor: pointer; transition: transform 0.3s ease; } .toaster-lever:hover { transform: translateY(5px); } .toaster-lever:active { transform: translateY(10px); } .toaster-light { width: 10px; height: 10px; background-color: #E0E0E0; border-radius: 50%; position: absolute; bottom: 15px; left: 15px; transition: background-color 0.3s ease; } .toaster.active .toaster-light { background-color: #FF5252; box-shadow: 0 0 10px #FF5252; animation: blink 0.5s infinite alternate; } @keyframes blink { from { opacity: 0.5; } to { opacity: 1; } } .toast-plate { width: 150.........完整代码请登录后点击上方下载按钮下载查看
网友评论0