在reveal.js中调暗背景图像
dim the background image in reveal.js
我使用的是reveal.js:我想显示一个全屏图像作为背景,一旦我移动到不同的幻灯片,我想模糊或模糊它。看看在Reveal.js中改变背景图像样式,我已经在我的css中尝试过了:
.html.blur .backgrounds {
-webkit-filter: blur(5px);
-moz-filter: blur(10px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
}
然后在markdown文档中添加html注释
.slide: data-background="figs/background.svg" data-background-size="contain" data-state="blur"
创建一个<section>
标签,里面有data-state="blur"
。然而,背景并没有变得模糊——我错过了什么?
只是一个打字错误:没有"."在html前面…
这将工作,除了模糊,做一些调光和饱和度的变化,这将使前景文本更容易阅读:
html.dim .backgrounds {
-webkit-filter: blur(4px) saturate(.5) brightness(.8);
-moz-filter: blur(4px) saturate(.7) brightness(.9);
-o-filter: blur(4px) saturate(.7) brightness(.9);
-ms-filter: blur(4px) saturate(.7) brightness(.9);
filter: blur(4px) saturate(.7) brightness(.9);
}
,如果你想让它看起来更时髦,你可以添加一个动画:
@-webkit-keyframes blur-animation {
0% {
-webkit-filter: blur(0px) ;
-moz-filter: blur(0px);
-o-filter: blur(0px);
-ms-filter: blur(0px);
filter: blur(0px);
}
100% {
-webkit-filter: blur(4px) saturate(.5) brightness(.8);
-moz-filter: blur(5px) saturate(.7) brightness(.9);
-o-filter: blur(5px) saturate(.7) brightness(.9);
-ms-filter: blur(5px)saturate(.7) brightness(.9);
filter: blur(5px) saturate(.7) brightness(.9);
}
}
html.background-blur-animation .backgrounds {
-webkit-animation-name: blur-animation;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: 1;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-out;
-webkit-animation-fill-mode: forwards;
-webkit-animation-delay: 0s;
}
请在源代码中检查这一行
html.blur.backgrounds {
//no (. sign)is required in front of .html or copy the above line and paste it.
相关文章:
- 可以在这里为背景图像设置滤镜吗
- 使用 js 将背景图像设置为 HTML
- 如何使用css动画/javascript使具有背景图像的元素出现
- 循环浏览多个身体背景图像
- 背景图像顶部的滚动图像不移动
- 在pdfmake中嵌入背景图像
- 修复选择菜单时的背景图像
- 使用css()设置背景图像;不起作用
- 鼠标悬停时如何居中放大背景图像
- 强制谷歌为javascript背景图像编制索引
- 淡入不带HTML的背景图像
- 具有淡入淡出效果的全背景图像
- 未加载随机背景图像
- 背景图像前显示Javascript警报
- javascript背景图像位置循环
- CSS动画背景图像的过渡越来越暗
- "Ken Burns效应”;悬停背景图像
- 通过ID JavaScript显示随机背景图像
- JavaScript背景图像
- 带有图像和背景图像的ClipTo