Skip to content

Commit f334362

Browse files
author
Warren Buckley
committed
Update readme example to show how to use on any DOM element
1 parent c87d553 commit f334362

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,19 @@ This allows for the navigation item to still have the class added to it when a c
306306
}
307307
```
308308

309+
Alternatively you can use the `our-active-class` attribute in conjuction with `our-active-href` attribute to apply this to any HTML DOM element on the page.
310+
311+
```cshtml
312+
<ul>
313+
@foreach (var item in Model.Root().Children)
314+
{
315+
<li our-active-href="@item.Url()" our-active-class="selected">
316+
<a href="@item.Url()" class="nav-link" our-active-class="nav-link--active">@item.Name</a>
317+
</li>
318+
}
319+
</ul>
320+
```
321+
309322

310323
## Video 📺
311324
[![How to create ASP.NET TagHelpers for Umbraco](https://user-images.githubusercontent.com/1389894/138666925-15475216-239f-439d-b989-c67995e5df71.png)](https://www.youtube.com/watch?v=3fkDs0NwIE8)

0 commit comments

Comments
 (0)