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>

(等...)

テストはしていませんが、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 に答える