tailwind+js实现动态抽屉式弹出层模态窗代码
代码语言:html
所属分类:弹出层
代码描述:tailwind+js实现动态抽屉式弹出层模态窗代码
代码标签: tailwind js 动态 抽屉式 弹出层 模态窗 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/tailwindcss.3.4.16.js"></script> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap" rel="stylesheet"> <style> /* Basic body styling to apply the Inter font */ body { font-family: 'Inter', sans-serif; } /* --- Keyframe Animations for Panel Sliding --- */ /* * These keyframes define the animation for panels sliding in and out from different directions. * Each animation starts from a transformed state (e.g., translateX(100%) for right) * and ends at its original position (translateX(0)). */ @keyframes slideInFromRight { from { transform: translateX(100%); } to { transform: translateX(0); } } @keyframes slideOutToRight { from { transform: translateX(0); } to { transform: translateX(100%); } } @keyframes slideInFromLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } } @keyframes slideOutToLeft { from { transform: translateX(0); } to { transform: translateX(-100%); } } @keyframes slideInFromTop { from { transform: translateY(-100%); } to { transform: translateY(0); } } @keyframes slideOutToTop { from { transform: translateY(0); } to { transform: translateY(-100%); } } @keyframes slideInFromBottom { from { transform: translateY(100%); } to { transform: translateY(0); } } @keyframes slideOutToBottom { from { transform: translateY(0); } to { transform: translateY(100%); } } /* Keyframe animation for content fading in with a slight upward translation */ @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } /* --- Panel Base Styling --- */ /* * Base styles for all panel elements. * They are fixed position, have a background, shadow, and a high z-index. * Initially, panels are hidden using `visibility: hidden;`. */ .panel { position: fixed; background-color: white; box-shadow: 0 0 30px rgba(0,0,0,0.2); z-index: 1000; visibility: hidden; /* Hidden by default */ } /* When a panel has the 'is-open' class, it becomes visible */ .panel.is-open { visibility: visible; } /* * Apply fadeIn animation to direct children of .panel-content when the panel is open. * This creates a staggered fade-in effect for the panel's internal content. */ .panel.is-open .panel-content > * { animation: fadeIn 0.5s both; } .pane.........完整代码请登录后点击上方下载按钮下载查看
网友评论0