Tag helper used to enable Lightbox in ASP.net Core MVC views.
- Using nuget:
Install-Package Tyrrrz.AspNetCore.Mvc.Lightbox
Make the tag helper available with the addTagHelper
directive either in your view or _ViewImports.cshtml
.
@addTagHelper *, Tyrrrz.AspNetCore.Mvc.Lightbox
Put the tag helper at the end of the body
to initialize Ligthbox.
<lightbox />
Mark the image links with data-lightbox="group-name"
as specified in the Lightbox documentation.
<a href="image.png" data-lightbox="gallery">
<img src="image.png" />
</a>
You can override default settings using attributes. The attribute names match the option names specified in the documentation.
<lightbox image-fade-duration="TimeSpan.FromSeconds(0.4)" max-width="500" wrap-around="true" />