【问题标题】:How can I style the extension Sidebar?如何设置扩展侧边栏的样式?
【发布时间】:2014-11-18 13:49:14
【问题描述】:

我的扩展程序中有以下侧边栏,但我想更改外观。我该怎么做?

var sidebar = new appAPI.sidebar({
  position: 'right',
  url: 'http://news.yahoo.com',
  html: 'Some Html',
  title: {
    content: 'Yahoo News',
    close: true
  },
  opacity: 1.0,
  width: '300px',
  height: '100%',
  preloader: true,
  sticky: true,
  slide: 150,
  openAction: ['click', 'dblclick'],
  closeAction: 'click',
  theme: 'default',
  scrollbars: false,
  openOnInstall: true

【问题讨论】:

  • 请发送fiddle,如果您提供更多关于您想要的“外观和感觉”的详细信息,它将对我们有所帮助。
  • 检查侧边栏的 DOM,查看 css 类并覆盖您想要的值

标签: css cross-browser styles sidebar crossrider


【解决方案1】:

有几种方法可以做到这一点,但我更喜欢的方法是使用适当的选择器将相关的 CSS 规则注入页面。因此,例如,将边框颜色更改为红色:

var inlineCss = '.crossrider-sidebar-'+appAPI.appInfo.id+'-container {' +
   'border-color:red !important;' +
'}';
appAPI.dom.addInlineCSS({css:inlineCss});

[披露:我是 Crossrider 的员工]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-21
    • 1970-01-01
    • 2017-12-06
    • 2018-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-19
    相关资源
    最近更新 更多