requestFullscreen实现单个图片电脑全屏显示代码

代码语言:html

所属分类:其他

代码描述:requestFullscreen实现单个图片电脑全屏显示代码

代码标签: requestFullscreen 单个 图片 电脑 全屏 显示 代码

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Fullscreen Image</title>
    <style>
        #fullscreenImage {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: contain;
            background-color: rgba(0, 0, 0, 0.9);
            z-index: 9999;
        }
    </style>
</head>
<body>

<button onclick="showFullscreenImage('//repo.bfw.wiki/bfwrepo/image/5d6539613d08b.png')">Show Fullscreen Image</button>

<img id="fullscreenImage" onclick="closeFullscreenImage()">

<script>
function showFullscreenImage(imageUrl) {
    const img = document.getElementById('fullscreenImage');
    img.src .........完整代码请登录后点击上方下载按钮下载查看

网友评论0