All Projects → thearnica → dom-locky

thearnica / dom-locky

Licence: MIT license
🙈🙉🙊 - the best way to scope a scroll, or literally any other event.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to dom-locky

public-speaking
🎤 List of presentation, volunteer and initiatives
Stars: ✭ 11 (-38.89%)
Mutual labels:  events
hertzy
Event bus channel
Stars: ✭ 48 (+166.67%)
Mutual labels:  events
PSEventViewer
PSEventViewer (Get-Events) is really useful PowerShell wrapper around Get-WinEvent. One of the features you may be interested in is a simple way of getting “hidden” events data
Stars: ✭ 74 (+311.11%)
Mutual labels:  events
go-observer
Go package for simplifying channel-based broadcasting of events from multiple publishers to multiple observers
Stars: ✭ 66 (+266.67%)
Mutual labels:  events
event-emitter
Event Emitter module for Nest framework (node.js) 🦋
Stars: ✭ 102 (+466.67%)
Mutual labels:  events
ngx-event-modifiers
Event Modifiers for Angular Applications https://netbasal.com/implementing-event-modifiers-in-angular-87e1a07969ce
Stars: ✭ 14 (-22.22%)
Mutual labels:  events
continuous-analytics-examples
A collection of examples of continuous analytics.
Stars: ✭ 17 (-5.56%)
Mutual labels:  events
vue-next-level-scroll
Bring your scroll game to the next level!
Stars: ✭ 49 (+172.22%)
Mutual labels:  scroll
react-bottom-scroll-listener
A simple listener component that invokes a callback when the webpage is scrolled to the bottom.
Stars: ✭ 129 (+616.67%)
Mutual labels:  scroll
VLCTechHub-site
VLCTechHub site
Stars: ✭ 23 (+27.78%)
Mutual labels:  events
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (+33.33%)
Mutual labels:  scroll
OverScroll
Use CoordinatorLayout+Behavior to achieve elastic scrolling and inertial scrolling for list. 利用CoordinatorLayout+Behavior实现弹性滚动和惯性滚动效果(类似微信首页).
Stars: ✭ 37 (+105.56%)
Mutual labels:  scroll
watermill-amqp
AMQP Pub/Sub for the Watermill project.
Stars: ✭ 27 (+50%)
Mutual labels:  events
sse
HTML5 Server-Sent-Events for Go
Stars: ✭ 84 (+366.67%)
Mutual labels:  events
SEPA
Get notifications about changes in your SPARQL endpoint.
Stars: ✭ 21 (+16.67%)
Mutual labels:  events
PoShLog
🔩 PoShLog is PowerShell cross-platform logging module. It allows you to log structured event data into console, file and much more places easily. It's built upon great C# logging library Serilog - https://serilog.net/
Stars: ✭ 108 (+500%)
Mutual labels:  events
magic-scroll
Apple Magic Mouse scrolling effect for normal mouses
Stars: ✭ 43 (+138.89%)
Mutual labels:  scroll
ng-mat-select-infinite-scroll
Infinite Scroll directive for angular material select component
Stars: ✭ 39 (+116.67%)
Mutual labels:  scroll
GoblinDB
Fear the Goblin! - An amazing, simple and fun database for humans
Stars: ✭ 54 (+200%)
Mutual labels:  events
SocketIOUnity
A Wrapper for socket.io-client-csharp to work with Unity.
Stars: ✭ 69 (+283.33%)
Mutual labels:  events

dom-locky

CircleCI status Greenkeeper badge npm

NPM

🙈Loki - is God of Mischief, Madness and Evil!

🙉Locky - is God of Locks, Event capturing and Stealing. Small and very slender brother - just 1kb.

🙊Locky will never let event escape the target node, will prevent scrolls outside, will do the HTML5 inert job.

Locky will completely disable any user iterations outside of nested children.

And it has a twin-brother - react-locky

import {lockyOn} from 'dom-locky';

const unlock = lockyOn('.modal', extraProps);
const unlock = lockyOn(myElement, { onEscape: callback });
//......
unlock();

Unpkg

You may also include this library from unpkg as https://unpkg.com/dom-locky. Then locky will be available as locky global variable.

API

Locky accepts selector or HTMLElement as a first argument, and locky will be activated only on the first element matching selector Locky accepts a settings as a second argument

  • onEscape, will be triggered when someone will try "escape" the lock. See "report" events below
  • noDefault[=false], disables all "default" events
  • events[=defaultEvents], DOM events to manage
  • group[=null], focus group id. Locks with the same group will not block each other.

Default events

  • click: 'report' (will call onEscape)
  • mousemove: true,
  • mousedown: 'report' (will call onEscape)
  • touchmove: true,
  • touchstart: 'report' (will call onEscape)
  • keydown: true,
  • focus: false, (focus is unblockable)
  • change: false,
  • scroll: true, (scroll is handled separately)
  • wheel: true,

Focus

Locky could not propely handle focus events, and will let it get out of the form, and will block attemps to return it, as long they will have source out of the lock. To scope a focus use dom-focus-lock

Tip

important tip for Mobile Safary - while normal "touch move" will scroll "scrollable" container, touch+move started on inputs will start drag-n-drop and cause whole layer(modal/page) scroll. (it will just scroll as a 💩, or not scroll at all).

To disable this behavior - apply -webkit-overflow-scrolling: touch; on the page.

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].