编辑标签explorer.js

时间:2016-11-06 10:23:49

标签: javascript css

我想删除tag-explorer.js生成的代码左侧显示的字母。我怎样才能做到这一点?

这是现场网站:https://ewelinawoloszyn.github.io/Research/research_03.html

这是脚本:

// The container to hold the tags.
tagContainer = document.querySelector('.tag-container');
// An array of objects where the `'element'` property is the article element (to
// be hidden), and the `'tags'` attribute is an array of tags on this article.
// Articles do not necessarily have to be the <article> element.
articles = [].slice.call(document.querySelectorAll('article')).map(function (article) {
  return {
   'element': article,
   'tags': [].slice.call(article.querySelectorAll('.tags li')).map(function (tag) {
     return tag.textContent;
   })
  };
});
// Create an array of tag names to be available for filtering.
tagNames = ['Public Finance', 'Access', 'Data','Money','Open Source'];
// Initialise tag-explorer.
tagExplorer(tagContainer, articles, tagNames);

这是所需的输出 - 我希望删除红色交叉字母: Here's the desired output

任何建议都非常感谢。

1 个答案:

答案 0 :(得分:1)

您可以通过更改文件style.css中的某些样式来隐藏这些字母:

改变这个:

.tag-container .letter-header {
  display: inline-block;
  padding: 0 1em;
}
.tag-container button {
  background-color: #AAA;
  color: #fff;
    -moz-border-radius: 0 3px 3px 0;
    -webkit-border-radius: 0 3px 3px 0;
    border-radius: 0 3px 3px 0;
    border: 0px;
    padding: 1px 6px;
}

到此(更改标有/* .. */):

.tag-container .letter-header {
  display: none;  /* <!-- modified */
  padding: 0 1em;
}
.tag-container button {
  margin: 0 5px;       /* <!-- added */
  background-color: #AAA;
  color: #fff;
  -moz-border-radius: 0 3px 3px 0;
  -webkit-border-radius: 0 3px 3px 0;
  border-radius: 0 3px 3px 0;
  border: 0px;
  padding: 1px 6px;
}

第一个更改导致字母未呈现。没有进一步的改变,这将使标签(按钮)彼此粘在一起。第二个变化处理这个问题,并在它们之间引入一个空白区域。

相关问题