Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在使用聚合物之前更改CSS应用于::_Javascript_Html_Css_Polymer - Fatal编程技术网

Javascript 在使用聚合物之前更改CSS应用于::

Javascript 在使用聚合物之前更改CSS应用于::,javascript,html,css,polymer,Javascript,Html,Css,Polymer,是否可以更改应用于使用::before指定的元素的CSS 例如: 我想改变这段CSS .wrapper { position: relative; z-index: 0; display: inline-block; background: #e5e5e5; } .wrapper::before { position: absolute; z-index: 1; top: 0; width: calc(100% - 15px);

是否可以更改应用于使用
::before
指定的元素的CSS

例如: 我想改变这段CSS

.wrapper {
    position: relative;
    z-index: 0;
    display: inline-block;
    background: #e5e5e5;
}

.wrapper::before {
    position: absolute;
    z-index: 1;
    top: 0;
    width: calc(100% - 15px); 
    height: 100%;
    box-shadow: inset 0 10px 10px -1px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    content: "";
}
这样,
box shadow
在特定时间通过javascript应用于类似于此过程的内容

addShadow : function() {
      var scroll = this.$.container.scrollTop;

      if(scroll >= 2) {
          this.$.wrapper.classList.add('shadow');
      } else {
          this.$.wrapper.classList.remove('shadow');
      }
  },

请随意编辑我的,并给我一些反馈

因为您已经在切换
.shadow
类,您只需更改css选择器即可:

.wrapper.shadow::before {

由于您已经在切换
.shadow
类,因此只需更改css选择器:

.wrapper.shadow::before {

嘿,Richard,我不能让它工作。你有没有办法编辑我的小提琴,让我看看我做错了什么?嘿,Richard,我没办法让它工作。你有没有办法编辑我的问题中添加的小提琴,让我知道我做错了什么?