Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yoannchb-pro/preshootjsv2
PreshootJsV2 is a new version of preshoot.js library inspired from premonish to predict on each object the user is going only with attributes to execute a function or to change the class of the object.
https://github.com/yoannchb-pro/preshootjsv2
js prediction premonish premonition preshoot v2
Last synced: 22 days ago
JSON representation
PreshootJsV2 is a new version of preshoot.js library inspired from premonish to predict on each object the user is going only with attributes to execute a function or to change the class of the object.
- Host: GitHub
- URL: https://github.com/yoannchb-pro/preshootjsv2
- Owner: yoannchb-pro
- License: mit
- Created: 2021-04-30T16:32:30.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-30T16:40:08.000Z (over 3 years ago)
- Last Synced: 2024-10-24T22:12:57.828Z (2 months ago)
- Topics: js, prediction, premonish, premonition, preshoot, v2
- Language: JavaScript
- Homepage:
- Size: 534 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PreshootJs v2
PreshootJsV2 is new version of preshoot.js a library inspired from premonish to predict on each object the user is going only with attributes to execute a function or to change the class of the object.
## Demo
- https://yoannchb-pro.github.io/PreshootJsV2/## Import
```html```
## How to use ?
Config preshoot.js
```js
const preshoot = new Preshoot(["#watchMe", ".watchMe"], {
fn: (event) => {
console.log(event);
},
exitFn: (event) => {
console.log(event);
},
className: "user-going-on"
}, {
mobile: true, //Look on mobile
detectWithArea: false, //If the cursor is not going on an object preshoot.js will detect the closer object
mouseInterval: 30, //The calcul will be make each 30 mouse move loop
resetClass: true, //Reset all the class if there are no matching element anymore
//Function to display when there is an error while executing the function of an object
onError: (el, msg) => {
console.warn("Error during executing function ", {
error: true,
element: el,
message: msg
});
}
});//Debug mode
Preshoot.debugMode(preshoot);//Start observing
preshoot.start();//Stop observing
preshoot.stop();
```
Set the default class when matching
```css
/* Default class when matching */
.preshoot{
border: 5px solid red!important;
}
```
How to use attributes ?
```html
```