Detect if a link has been clicked and apply a different CSS class if it has

前端 未结 5 1821
轻奢々
轻奢々 2021-01-14 12:53

So what I want to do is determine if the current link is \'active\', i.e. if this link was just clicked by the user.

If it is, then I want to apply the class=s

5条回答
  •  悲&欢浪女
    2021-01-14 13:27

    I'm guessing that this is for something like a tabbed UI where you want the currently selected tab to look different?

    Try link_to_unless_current, then style the list items containing links differently from tabs containing plain text.

提交回复
热议问题