0

I tried some stuff I found in past questions but unfortunately it hasn't helped. I think the reason may be it is deeply buried in CSS classes and I'm just inexperienced and not targeting it accurately, despite my attempts to use Chrome's inspect element to find exactly where it is. This is the code I have:

.multilanguage-widget.readmore ul.display-posts-listing li.listing-item a.current {
        font-weight: bold !important;
        }

and this is the page example I'm trying to do it on here. See the list of Capabilities to the right side. Please help, I've been struggling with this for quite a while now and all my attempts have been failing.

4

2 回答 2

0

您可以编写一个脚本,从所有活动元素中删除该类并将其添加到单击的元素中:

<script type="text/javascript">
   function active(e) {
      $$('.current').each(function(i) {
         i.removeClassName('current');
      });
      e.addClassName('current');
   };
</script>

然后,您可以从 onclick 事件中调用此函数:

<a class="title" href="http://lumistaging.designiscasual.com/biometrics/" onclick="active(this)">Biometric Authentication</a>
<a class="title" href="http://lumistaging.designiscasual.com/barcode/" onclick="active(this)">Barcode Authentication</a>

(ETC...)

我还没有测试过,但你的 CSS 应该可以正常工作。

于 2013-01-22T19:51:33.630 回答
0

如果您的页面足够一致,您可以使用以下内容:

<script>
$(document).ready(function(){
   $('ul.display-posts-listing li').children('a').filter(function(){
      return ($(this).html() == $('h1.entry-title').html())
   }).addClass('current');
});
</script>

我会把它放在标签header.php之前。</head>

于 2013-01-22T19:45:04.733 回答