![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Add momentum to anything. It's like iScroll, except not for scrolling. Supports mouse and touch events.
Add momentum to anything. It's like iScroll, except not for scrolling. Supports mouse and touch events.
Check out the demos on the home page.
Impetus will probably never support anything other than simple momentum. If you need scrolling or touch carousels or anything like that, this probably isn't the tool you're looking for.
var myImpetus = new Impetus({
source: myNode,
update: function(x, y) {
// whatever you want to do with the values
}
});
You give it an area to listen to for touch or mouse events, and it gives you the x
and y
values with some momentum.
Impetus will register itself as an AMD module if it's available.
Type | Default | Description | |
---|---|---|---|
source | HTMLElement |String | document | Element reference or query string for the target on which to listen for movement. |
update (required) | function(x, y) | - | This function will be called with the updated x and y values. |
multiplier | Number | 1 | The relationship between the input and output values. |
friction | Number | 0.92 | Rate at which values slow down after you let go. |
initialValues | [Number, Number] | [0, 0] | Array of initial x and y values. |
boundX | [Number, Number] | - | Array of low and high values. x-values will remain within these bounds. |
boundY | [Number, Number] | - | Array of low and high values. y-values will remain within these bounds. |
bounce | Boolean | true | Whether to stretch and rebound values when pulled outside the bounds. |
Description | |
---|---|
.pause() | Disable movement processing. |
.resume() | Re-enable movement processing. |
.setMultiplier( <number> ) | Adjust the multiplier in flight. |
.setValues( <number> , <number> ) | Adjust the current x and y output values. |
.setBoundX( <number[2]> ) | Adjust the X bound |
.setBoundY( <number[2]> ) | Adjust the Y bound |
.destroy() |
This will remove the previous event listeners. Returns null so you can use it to destroy your variable if you wish, i.e. instance = instance.destroy()
|
Chrome, Firefox, Safari, Opera, IE 9+, iOS, Android. Support for IE 8 can be achieved by adding a polyfill for addEventListener
.
FAQs
Add momentum to anything. It's like iScroll, except not for scrolling. Supports mouse and touch events.
The npm package impetus receives a total of 4,146 weekly downloads. As such, impetus popularity was classified as popular.
We found that impetus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.