在reveal.js中调暗背景图像

时间:2015-08-17 16:44:51

标签: javascript html css reveal.js

我使用reveal.js:我想将全屏图像显示为背景,一旦我移动到另一张幻灯片,我就想模糊或调暗它。 看Changing the background-image style in 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);
}

然后在我的降价文档中,我用

做了一个html评论
.slide: data-background="figs/background.svg" data-background-size="contain" data-state="blur"

在其中创建<section>标记data-state="blur"。但是,背景并没有模糊 - 我缺少什么?

2 个答案:

答案 0 :(得分:5)

只是一个错字:没有&#34;。&#34;在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;
 }

答案 1 :(得分:0)

请在您的来源中查看此行

 html.blur.backgrounds {     
                   //no (. sign)is required in front of .html or copy the above line and paste it.
相关问题