首页 > 其他分享 >View Transitions API 使用

View Transitions API 使用

时间:2024-05-04 14:34:28浏览次数:12  
标签:bg color -- API Transitions View

View Transitions API 提供了一种机制,可以在更新 DOM 内容的同时,轻松地创建不同 DOM 状态之间的动画过渡,这是官方对他的描述,详情请看这里

下方创建好了

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        :root {
            --bg-color: #fff;
            background-color: var(--bg-color);
        }
        :root.dark {
            --bg-color: #000;
        }
    </style>
</head>
<body>
    <button id="btn">切换</button>
</body>
<script>
    btn.addEventListener('click', () => {
        document.documentElement.classList.toggle('dark');
    })
</script>
</html>

标签:bg,color,--,API,Transitions,View
From: https://www.cnblogs.com/xiaojiuwow/p/18172270

相关文章

  • ffmpeg常用API笔记
    1.ffmpeg日志系统<libavutil/log.h>1)av_log_set_level(AV_LOG_DEBUG)2)av_log(NULL,AV_LOG_INFO,"fmt...",op) 2.<libavformat/avformat.h>操作目录:1)avio_open_dir()打开一个目录。结构体AVIODirContext,表示目录的上下文信息。//参数1:上下文;参数2:要访问的目录的ur......
  • webapi添加添加websocket中间件
    添加位置我按照MSDN的例子添加了一个复述客户端响应的中间件。需要注意的时,中间件采用那种方式添加,添加在哪。哪种方式我选择创建一条管道分支,只要时ws的连接请求,就转到这个分支因此,我们需要使用的是MapWhen()来创建管道分支。添加在哪要注意授权的问题,所以应该添加到授权......
  • webapi中间件没有使用终结点中间件时的注意事项
    最小webapi默认的中间件配置是这样的app.UseHttpsRedirection();app.UseAuthorization();app.MapControllers();app.Run();最小webapi没有使用app.UseRouting()和app.UseEndpoints。这种情况下我们添加的所有中间件其实都是位于终结点路由中间件EndpointRoutingMiddleware......
  • simpread-课程 28:API 接口请求日志【后端】
    1、添加审核日志实体1.1实体定义在项目Electric.Entity,添加文件夹:AuditLogs,并添加类:EleAuditLog。EleAuditLog完整代码如下:namespaceElectric.Entity.AuditLogs;///<summary>///审核日志///</summary>[Index(nameof(AuditLogType))]publicclassEleAuditLog:E......
  • 个人网页-测试程序-网页成功与api交互但未显示好的图片
    python:fromflaskimportFlask,render_template,request,jsonifyimportrequestsimportbase64importosfromPILimportImageimportioimportlogging#ConfigureFlaskapplicationapp=Flask(__name__,template_folder='../templates')app.c......
  • WPF TreeView HierarchicalDataTemplate
    //xaml<Windowx:Class="WpfApp87.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.mic......
  • WPF CollectionViewSource GroupDescriptions GroupStyle ItemsPanelTemplate
    <Windowx:Class="WpfApp83.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.......
  • WPF CollectionViewSource GroupDescriptions PropertyGroupDescription GroupStyle
    <Windowx:Class="WpfApp83.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.......
  • WPF CollectionViewSource ICollectionViewLiveShaping IsLiveSorting
    <Windowx:Class="WpfApp82.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.......
  • 开源文档预览项目 kkFileView (9.9k star) ,快速入门
    kkFileView是一款文件文档在线预览解决方案,采用流行的SpringBoot框架构建,易于上手和部署。该项目基本支持主流办公文档的在线预览,包括但不限于doc、docx、xls、xlsx、ppt、pptx、pdf、txt、zip、rar,以及图片、视频、音频等格式。1Docker部署拉取镜像:#网络环境方便......