Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastiandedeyne/rafaeljs
Vanilla javascript helper to easily bind window resize and scroll events via requestAnimationFrame.
https://github.com/sebastiandedeyne/rafaeljs
Last synced: 14 days ago
JSON representation
Vanilla javascript helper to easily bind window resize and scroll events via requestAnimationFrame.
- Host: GitHub
- URL: https://github.com/sebastiandedeyne/rafaeljs
- Owner: sebastiandedeyne
- License: mit
- Created: 2014-12-26T15:56:57.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-26T16:16:58.000Z (almost 10 years ago)
- Last Synced: 2024-10-17T16:06:11.981Z (27 days ago)
- Language: CoffeeScript
- Size: 117 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RafaelJS
Vanilla javascript helper to easily bind window resize and scroll events via requestAnimationFrame.Work in progress!
## Usage
### Basic Example
```
var rafael = new Rafael();rafael.bind('scroll', function() {
console.log('Scrolled!');
});
```### Available events
```
resize, resizeX, resizeY, scroll, scrollX, scrollY, raf
```Note: `raf` binds directly to `window.requestAnimationFrame`.
### Methods
- `bind`: Bind an event to the rafael instance
- `stop`: Disables all registered events
- `start`: Re-enables all registered events
- `enabled`: Returns a boolean describing whether the rafael instance is enabled or not
- `dimensions`: Returns an object with the window's current dimensions
- `oldDimensions`: Returns an object with the window's current dimensions before the last requestAnimationFrame call
- `positions`: Returns an object with the document's current scrollpositions
- `oldPositions`: Returns an object with the document's current scrollpositions before the last requestAnimationFrame call## Build
Compile:
```
$ coffee -cb rafael.coffee
```Watch:
```
$ coffee -wb rafael.coffee
```