Previous
Navigation drawer
import { Navbar } from "@overdog/fn"
new Navbar("#navbar-sticky", {
behavior: "sticky"
}).init()
If you are using multiple elements from Overdog FN that require the same variants, you only need to add them once. You can also modify the data attributes added to each function using the attributes parameter {}.
module.exports = {
// ...
plugins: [
plugin(function ({ addVariant }) {
addVariant("is-open", "&[data-fn-is-open]")
addVariant("parent-is-open", "[data-fn-is-open] &")
})
]
}
<div id="navbar-sticky" class="sticky w-full h-16 z-30 top-0 border-b border-blue-500" >
{# background div with opacity change - better performance than background-color change #}
<div class="opacity-0 h-full w-full absolute top-0 left-0 bg-blue-500 transition-opacity parent-is-open:opacity-100"></div>
</div>