1.0.0 • Published 3 years ago
svelte-action-outclick v1.0.0
Installation
npm install svelte-action-outclick
Usage
<script>
import { aOutClick } from "svelte-action-outclick";
</script>
<div use:aOutClick={{ excludeSelection : "button.blue, div.red", rightClick: true }} on:outclick={()=> doSomething()}>Don't click</div>
<div class="blue">blue div</div>
<div class="red">red div will be excluded</div>
<div class="green">green div</div>
<button class="blue">blue button will be excluded</button>
<button class="red">red button</button>
<button class="green">green button</button>
<style>
.blue {
background-color: blue;
color: white;
}
.red {
background-color: red;
color: white;
}
.green {
background-color: green;
color: white;
}
</style>
Action Parameters
Parameter | Type | Description |
---|---|---|
excludeSelection | string | Optional. A css selector of excluded elements |
rightClick | boolean | Optional. Allow right clicks as a trigger to an outclick event |
License
Distributed under the MIT License.
1.0.0
3 years ago