当前位置: 首页 > news >正文

使用transform对html的video播放器窗口放大

核心是使用

<div class="video" style="width: 100%; height:700px;">播放容器</div>$('video').css({'transform': 'scale(2)','transform-origin': 'center top'});

其中

scale 表示放大倍数,可以是小数

transform-origin 表示位置,

1)可以使用坐标点 如 '120px 200px'

2)或者使用方位坐标,left right top bottom总共九个 ,如

左上方 'left top' 

上方 ‘top center’

右上方 'right top'

左方 'left center'

中间 'center center'

右方 'right center'

左下方 'right bottom'

下方 'bottom center'

右下方 'right bottom'

以下是html示例代码

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Video Scaling and Positioning</title>
  <style>
    .video-container {
      position: relative;
      width: 100%;  /* 容器宽度 */
      height: 100vh; /* 容器高度 */
      overflow: hidden; /* 超出部分隐藏 */
    }

    video {
      position: absolute;
      top: 50%;   /* 垂直居中 */
      left: 50%;  /* 水平居中 */
      transform: translate(-50%, -50%) scale(1); /* 初始缩放为1,居中 */
      transition: transform 0.5s ease; /* 增加缩放时的平滑过渡效果 */
    }

    /* 当鼠标悬停时,缩放并调整位置 */
    video:hover {
      transform: translate(-30%, -30%) scale(1.5); /* 缩放到1.5倍并移动位置 */
    }
  </style>
</head>
<body>
  <div class="video-container">
    <video src="video.mp4" controls></video>
  </div>
</body>
</html>


http://www.mrgr.cn/news/23178.html

相关文章:

  • 多路转接之poll(接口介绍,struct pollfd介绍,实现原理,实现非阻塞网络通信代码)
  • 八、3 DMA数据转运(代码)
  • Linux内核的调试(TODO)
  • 【剑指offer】题解:和为S的两个数字
  • 【网络安全 | 渗透工具-目录FUZZ】ffuf安装使用详细教程
  • 【附源码】Python :斐波那契数列(10种方法计算第n项)
  • mysql——关于表的增删改查(CRUD)
  • 【880高数】高等数学一刷错题整理
  • 华为-2022-测试面试题
  • 概率论原理精解【12】
  • 机器人领域超重量奖项TRO傅京孙最佳论文奖汇总【上】
  • 每日一题,力扣leetcode Hot100之206反转链表
  • 【C++】C++入门基础,详细介绍命名空间,缺省参数,函数重载,引用,内联函数等
  • 11大排序的原理讲解和Python源码剖析
  • 【Kubernetes知识点问答题】监控与升级 / ETCD 备份与恢复
  • 田纳西州橡树岭全球最快的超级计算机名为Frontier
  • 【LabVIEW学习篇 - 18】:人机界面交互设计02
  • Lua协同程序Coroutine
  • HTTrack
  • 点餐小程序实战教程04变量定义和初始化