Answers for "alpine js examples"

2

alpine js

<div x-data="{ open: false }">
    <button @click="open = true">Open Dropdown</button>

    <ul
        x-show="open"
        @click.away="open = false"
    >
        Dropdown Body
    </ul>
</div>
Posted by: Guest on October-25-2020
0

alpine js open outside div

<div x-data="{id: 1}">
    <button @click="$dispatch('open-dropdown',{id})">Open Dropdown</button>
</div>

<ul x-data="{ open: false }"
    x-show="open"
    @open-dropdown.window="if ($event.detail.id == 1) open = true"
    @click.away="open = false">
    Dropdown Body
</ul>
Posted by: Guest on October-11-2020
0

alpine js

<div x-data="{ open: false }">
    <button @click="open = true">Open Dropdown</button>

    <ul
        x-show="open"
        @click.away="open = false"
    >
        Dropdown Body
    </ul>
</div>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
Posted by: Guest on March-12-2021
0

alpine js

<div x-data="{ tab: 'foo' }">
    <button :class="{ 'active': tab === 'foo' }" @click="tab = 'foo'">Foo</button>
    <button :class="{ 'active': tab === 'bar' }" @click="tab = 'bar'">Bar</button>

    <div x-show="tab === 'foo'">Вкладка Foo</div>
    <div x-show="tab === 'bar'">Вкладка Bar</div>
</div>
Posted by: Guest on March-27-2021
0

alpine js

< script  src = " https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js " defer > </ script >
Posted by: Guest on March-27-2021
0

alpinejs

<html>  <head>    ...     <script defer src="https://unpkg.com/[email protected]/dist/cdn.min.js"></script>  </head>  ...</html>
Posted by: Guest on October-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language