All Projects → linuxenko → move-into-view

linuxenko / move-into-view

Licence: MIT license
move-into-view is such as sroll-into-view but better

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to move-into-view

seamless-scroll-polyfill
Scroll Behavior polyfill
Stars: ✭ 134 (+306.06%)
Mutual labels:  scrollintoview
sapa
sapa is a library that creates a UI with a simple event system.
Stars: ✭ 65 (+96.97%)
Mutual labels:  dom
zero-drag
Minimal abstraction of DOM drag-and-drop interactions
Stars: ✭ 17 (-48.48%)
Mutual labels:  dom
lego
🚀 Web-components made lightweight & Future-Proof.
Stars: ✭ 69 (+109.09%)
Mutual labels:  dom
CDom
Simple HTML/XML/BBCode DOM component for PHP.
Stars: ✭ 26 (-21.21%)
Mutual labels:  dom
react-append-to-body
React Higher order component that allows you to attach components to the DOM outside of the main app.
Stars: ✭ 30 (-9.09%)
Mutual labels:  dom
zig-wasm-dom
Zig + WebAssembly + JS + DOM
Stars: ✭ 81 (+145.45%)
Mutual labels:  dom
cheatsheets
📋 Various cheatsheets made while working as a developer
Stars: ✭ 22 (-33.33%)
Mutual labels:  dom
paginathing
a jQuery plugin to paginate your DOM easily.
Stars: ✭ 23 (-30.3%)
Mutual labels:  dom
rottenjs
An all-in-one (2.6kb) Javascript library for web development
Stars: ✭ 15 (-54.55%)
Mutual labels:  dom
anim8js
The ultimate animation library for javascript - animate everything!
Stars: ✭ 33 (+0%)
Mutual labels:  dom
hsx
Static HTML sites with JSX and webpack (no React).
Stars: ✭ 15 (-54.55%)
Mutual labels:  dom
s60-maps
Yet another maps for Symbian OS
Stars: ✭ 27 (-18.18%)
Mutual labels:  positioning
front-end-notes
前端课程学习笔记汇总
Stars: ✭ 57 (+72.73%)
Mutual labels:  dom
vanilla-jsx
Vanilla jsx without runtime. HTML Tag return DOM in js, No virtual DOM.
Stars: ✭ 70 (+112.12%)
Mutual labels:  dom
recks
🐶 React-like RxJS-based framework
Stars: ✭ 133 (+303.03%)
Mutual labels:  dom
rem
An HTML parsing library, written in Zig.
Stars: ✭ 56 (+69.7%)
Mutual labels:  dom
zebrajs
A modular, jQuery compatible, ultra light-weight JavaScript micro-library for modern browsers
Stars: ✭ 26 (-21.21%)
Mutual labels:  dom
theBookOfNoah
Everything ive learned developing web applications
Stars: ✭ 22 (-33.33%)
Mutual labels:  dom
foliage
🍃 Style your components with performance
Stars: ✭ 29 (-12.12%)
Mutual labels:  dom

moveIntoView() shim (demo, animated demo)

Build Status Coveralls npm version license Standard - JavaScript Style Guide semantic-release

moveIntoView() is such as scrollIntoView() Element shim but without scrolling, it move element into aspect ratio based position instead. Very useful for css driven scroll animations instead of heavy cpu based animations often used for scrolls.

Schema

Installation

Using npm:

npm install move-into-view

CDN version:

minified:

<script src="https://unpkg.com/move-into-view@latest/miw.min.js"></script>

debug
<script src="https://unpkg.com/move-into-view@latest/miw.js"></script>

Usage

html markup for example

 </style>

  <div class="parent">
    <div class="wrapper">
      <div class="child"></div>
      <div class="child"></div>
      <div class="child"></div>
      <div id="center-me" class="child"></div>
      <div class="child"></div>
    </div>
  </div>

shim usage example

 document.getElementById('center-me').moveIntoView() // both x and y
 document.getElementById('center-me').moveIntoView({x: 0})
 document.getElementById('center-me').moveIntoView({y: 0.3})
 document.getElementById('center-me').moveIntoView({x: 1})

Commonjs usage:

var MoveIntoView = require('move-into-view');

MoveIntoView(childElement).move.x(0.3);
MoveIntoView(childElement).move.y(1);
MoveIntoView(childElement).move.both(1);

Animate it using css:

  .wrapper {
    transition: left .2s ease; /* anything */
  }

Only calculated position without applying it into element:

MoveIntoView(childElement).position(); // default 0.5 0.5
MoveIntoView(childElement).position(1); // x: 1  y default 0.5

MoveIntoView(childElement).position(0.5, 0.5); 

// returns { x: Number, y: Number }

License

MIT 2017 Svetlana Linuxenko

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