Styling Polymer paper-slider

南笙酒味 提交于 2019-11-28 13:44:58

You could use selectors like ::shadow and /deep/ but they are deprecated. If an element doesn't provide the hooks (CSS variables and mixins) then you're basically out of luck.

What you can do, is to create a feature request in the elements GitHub repo to support additional selectors.

Another workaround I already used successfully is to add a style module.

var myDomModule = document.createElement('style', 'custom-style');
myDomModule.setAttribute('include', 'mySharedStyleModuleName');
Polymer.dom(sliderElem.root).appendChild(myDomModule);

I hope the syntax is correct. I use Polymer only with Dart. The dom-module needs to be a custom-style even though this is normally only necessary when used outside a Polymer element.

See also https://github.com/Polymer/polymer/issues/2681 about issues I run into with this approach.

The following code is working for me,

attached: function(){
  var sliderContainer = document.querySelector("#sliderContainer.editable.paper-slider");
  sliderContainer.style.marginTop = "5px"; 
  sliderContainer.style.marginBottom = "5px";
},
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!