js+css实现video视频右下角悬浮播放切换代码

代码语言:html

所属分类:多媒体

代码描述:js+css实现video视频右下角悬浮播放切换代码,让您在多任务处理时也能轻松观看视频内容。

代码标签: js css video 视频 右下角 悬浮 播放 切换 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.min.css">
   <style>
       * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif
}

body {
    background: linear-gradient(135deg,#1a2a6c,#b21f1f,#fdbb2d);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,#4a90e2,#fc0,#e74c3c)
}

h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
    background: linear-gradient(90deg,#fff,#fc0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700
}

.subtitle {
    font-size: 1.3rem;
    opacity: .9;
    max-width: 700px;
    margin: 0 auto;
    color: #e0e0e0
}

.video-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px
}

.main-video {
    width: 100%;
    max-width: 900px;
    background: rgba(0,0,0,0.4);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    transition: all .5s ease;
    border: 1px solid rgba(255,255,255,0.1)
}

.main-video video {
    width: 100%;
    display: block;
    border-radius: 20px 20px 0 0
}

.video-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: rgba(0,0,0,0.3)
}

.control-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg,#4a90e2,#3a7bc8);
    color: white;
    border: 0;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all .3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2)
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3)
}

.control-btn:active {
    transform: translateY(1px)
}

.control-btn i {
    font-size: 1.2rem
}

.floating-video {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 320px;
    height: 200px;
    background: rgba(0,0,0,0.8);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0,0,0,0.6);
    z-index: 1000;
    transition: all .5s cubic-bezier(0.175,0.885,0.32,1.275);
    transform: scale(0);
    opacity: 0;
    border: 2px solid rgba(255,255,255,0.2)
}

.floating-video.active {
    transform: scale(1);
    opacity: 1
}

.floating-video video {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.floating-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0