All Projects → gravmatt → Force Js

gravmatt / Force Js

Licence: mit
The easy way to scroll and animate your page

Programming Languages

javascript
184084 projects - #8 most used programming language
js
455 projects

Projects that are alternatives of or similar to Force Js

Push State
Turn static web sites into dynamic web apps.
Stars: ✭ 16 (-97.01%)
Mutual labels:  animations, jquery
Jquery Animatenumber
jQuery animate number
Stars: ✭ 768 (+43.28%)
Mutual labels:  animations, jquery
React Burger Menu
🍔 An off-canvas sidebar component with a collection of effects and styles using CSS transitions and SVG path animations
Stars: ✭ 4,544 (+747.76%)
Mutual labels:  animations
Jquery Cropper
A jQuery plugin wrapper for Cropper.js.
Stars: ✭ 516 (-3.73%)
Mutual labels:  jquery
Jquery.thailand.js
ตัวช่วยกรอกที่อยู่ที่ดีที่สุดในไทย ไม่ต้องใช้ Server Side!
Stars: ✭ 490 (-8.58%)
Mutual labels:  jquery
Jquery Store Locator Plugin
A store locator plugin using Google Maps API version 3
Stars: ✭ 471 (-12.13%)
Mutual labels:  jquery
Fe Interview Questions
目前最全的前端开发面试题及答案
Stars: ✭ 502 (-6.34%)
Mutual labels:  jquery
Trail Android
🚕 Simple, smooth animation for route / polylines on google maps using projections.
Stars: ✭ 465 (-13.25%)
Mutual labels:  animations
Responsive Tabs
Responsive Tabs is a jQuery plugin that provides responsive tab functionality. The tabs transform to an accordion when it reaches a CSS breakpoint. You can use this plugin as a solution for displaying tabs elegantly on desktop, tablet and mobile.
Stars: ✭ 529 (-1.31%)
Mutual labels:  jquery
Domjudge
DOMjudge programming contest jury system
Stars: ✭ 484 (-9.7%)
Mutual labels:  jquery
Intercooler Js
Making AJAX as easy as anchor tags
Stars: ✭ 4,662 (+769.78%)
Mutual labels:  jquery
Jtsage Datebox
A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
Stars: ✭ 481 (-10.26%)
Mutual labels:  jquery
Bugcatcher
方便产品、开发、测试三方协同管理、测试、监控项目进度和质量,以持续交付。
Stars: ✭ 472 (-11.94%)
Mutual labels:  jquery
React Motion Layout
🦸 Beautiful immersive React hero animations.
Stars: ✭ 509 (-5.04%)
Mutual labels:  animations
Ignite Ui
Ignite UI by Infragistics
Stars: ✭ 468 (-12.69%)
Mutual labels:  jquery
Ajax Datatables Rails
A wrapper around DataTable's ajax methods that allow synchronization with server-side pagination in a Rails app
Stars: ✭ 520 (-2.99%)
Mutual labels:  jquery
Sco.js
Javascript extensions for twitter bootstrap
Stars: ✭ 465 (-13.25%)
Mutual labels:  jquery
Instagram Clone
An Instagram-clone with my own flavors and features. Own the project with 5 simple steps!! 📸💝☢️
Stars: ✭ 479 (-10.63%)
Mutual labels:  jquery
Html5
HTML5学习、总结、实践
Stars: ✭ 493 (-8.02%)
Mutual labels:  jquery
Paroller.js
Parallax scrolling jQuery plugin
Stars: ✭ 535 (-0.19%)
Mutual labels:  jquery

Force.js

Finally, an easy way to animate elements and jump around on your page.

It has different easing functions (listed below) and tries (by default) to use CSS-Transitions to animate elements.

If the browser doesn't support transitions, force.js fallback to native javascript functions.

Force.js support even older browser version with no transition support.

Go to the force-js page and try it out!

To use it on your page, just write this line of code in the HTML HEAD or on the bottom of the BODY tag.

<script src="force.js" type="text/javascript"></script>

Support for AMD and Node Module Pattern (Including browserify)

Get it on Bower

bower install force-js

Get it via cdnjs

Just copy and paste it into your project.

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/force-js/0.1.1/force.min.js"></script>

Go to the force-js page on cdnjs.

jQuery

Force.js is 100% pure vanilla!!!

But for all the coders who don't want to miss jQuery.

Force.js automatically detects jQuery and extend its Objects with the force.move() and force.jump() function.

So you are able to use force.js in an jQuery object.

$('#ball').move({left: 100px, top: 50px}, 1000);

To use force.js in jQuery, write the jQuery TAG first. So force.js can extend its objects afterwards.

Jump

Doing jumps on the page are easier than every.

To automatically detect hash links on your page, just use the force.bindHashes() function like this.

force.bindHashes();

But if you want to do it by yourself, use the force.jump() function.

var element = document.getElementBy('element-id');

// jump by object
force.jump(element);

// jump by selector
force.jump('#element-id');

You can use the function with additional options.

force.jump(target);

var options = {
  setHash: false
  // if set to TRUE, it sets the hash/id value of the element in the URL

  duration: 500,
  done: function() {},
  easing: 'easeInQuad',
};
force.jump(target, options);

Or the jQuery extention.

$('#ball').jump();

//$('#ball').jump(options);

Move

You can also animate elements with force.js.

To do so, just use the force.move() function.

var element = document.getElementBy('element-id');

// jump by object
force.move(element, {left: 100px, top: 50px}, 1000);

// jump by selector
force.move('#element-id', {left: 100px, top: 50px}, 1000);

You can use the function with additional options.

force.move(target, properties, duration, doneCallback);

var options = {
  properties: {
    left: '100px'
  },
  duration: 500,
  done: function() {},
  easing: 'easeInQuad'
};
force.move(target, options);

Or the jQuery extention.

$('#ball').move({left: 100px, top: 50px}, 1000);

// $('#ball').move(options, duration, doneCallback);

Don't worry if you use the function multiple times.

The force.move() function is cached!

That means, the function just get executed if the previous call is done.

Options

In force.js you are able to modify everything you want to fit your needs.

// edit single option
force.opt.cacheScrolling = true;

// or use the config function and paste an object to override the old settings.
force.config( { cacheScrolling: true } );

hashLinkPattern: 'a[href*="#"]:not([])'

This is a selector to find the hash links in your page by exectuting the force.bindHashes() function.

frames: 60

By default, force.js runs at 60 fps.

You can edit this property as well.

But be careful!

You can increase but also decrease the performance of the page.

moveDuration: 1000 AND jumpDuration: 1000

The default duration for the force.move() and force.jump() function is 1000 ms. You can override this value inside the functions by set the duration property in the config object if you want to.

moveEasing: 'swing' AND jumpEasing: 'swing'

The default easing function is swing but you can change this to:

  • swing
  • easeInQuad
  • easeOutQuad
  • easeInOutQuad
  • easeInCubic
  • easeOutCubic
  • easeInOutCubic
  • easeInQuart
  • easeOutQuart
  • easeInOutQuart
  • easeInQuint
  • easeOutQuint
  • easeInOutQuint
  • easeInSine
  • easeOutSine
  • easeInOutSine
  • easeInExpo
  • easeOutExpo
  • easeInOutExpo
  • easeInCirc
  • easeOutCirc
  • easeInOutCirc
  • easeInElastic*
  • easeOutElastic*
  • easeInOutElastic*
  • easeInBack*
  • easeOutBack*
  • easeInOutBack*
  • easeInBounce*
  • easeOutBounce*
  • easeInOutBounce*

* This easing functions doesn't work with css transitions and use native javascript. But don't worry, force.js does it automatically for you!

cacheJumps: true

Page jumps are cached by default.

That means, the next jump only animates if the previous is finished.

Set it to FALSE and the jump stops immediately and starts the new jump.

cssTransitions: true

By default, force.js try to use css transitions if the browser supports it.

Using transitions looks much smoother than native javascript and doesn't block the event loop.

I would recommend it to let it turned ON by default.

force.js manage the usage of transitions automatically if the browser doesn't support it.

Licence

Force.js is published under the MIT licence. So feel free to use, share or modify it!

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].