Coder Social home page Coder Social logo

freddesign / rellax Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dixonandmoe/rellax

0.0 2.0 0.0 85 KB

Lightweight, vanilla javascript parallax library

Home Page: https://dixonandmoe.com/rellax/

License: MIT License

CSS 15.15% HTML 64.47% JavaScript 20.38%

rellax's Introduction

RELLAX

Rellax is a buttery smooth, super lightweight (1021bytes gzipped), vanilla javascript parallax library. Update: Rellax now works on mobile (v1.0.0).

Have any suggestions or feedback? Reach out @dixonandmoe

🎉 Hiring Designers: Are you using Rellax on a project? Does having a 🍺/☕️/🍵, playing Soundcloud remixes, and experimenting with new design and code ideas get you all giddy? Yea, us too 😜. We're hiring a Junior Frontend Designer in San Francisco (sorry no remote). Let's chat [email protected].

Getting Started

npm install rellax --save or if you're old school like us download and insert rellax.min.js

<div class="rellax">
  I’m that default chill speed of "-2"
</div>
<div class="rellax" data-rellax-speed="7">
  I’m super fast!!
</div>
<div class="rellax" data-rellax-speed="-4">
  I’m extra slow and smooth
</div>

<script src="rellax.min.js"></script>
<script>
  // Accepts any class name
  var rellax = new Rellax('.rellax');
</script>
<script>
  // Also can pass in optional settings block
  var rellax = new Rellax('.rellax');
</script>

Features

Centering

After some fantastic work from @p-realinho, we just released the ability to center parallax elements in your viewport! We'll be building a nice demo website, but for now check out the tests folder for several examples of how it works.

There's two ways to implement centering, either on specific elements or as a global option.

<div class="rellax" data-rellax-percentage="0.5">
  I’m that default chill speed of "-2" and "centered"
</div>
<div class="rellax" data-rellax-speed="7" data-rellax-percentage="0.5">
  I’m super fast!! And super centered!!
</div>
<div class="rellax" data-rellax-speed="-4" data-rellax-percentage="0.5">
  I’m extra slow and smooth, and hella centered.
</div>
<script>
  // Center all the things!
  var rellax = new Rellax('.rellax', {
    center: true
  });
</script>

Destroy

<script>
  // Start Rellax
  var rellax = new Rellax('.rellax');
  
  // End Rellax and reset parallax elements to their original positions
  rellax.destroy();
</script>

In the Wild

If you're using Rellax in production, we'd love to list you here! Let us know: [email protected]

Development

In the spirit of lightweight javascript, the build processes (thus far) is lightweight also.

  1. Open demo.html
  2. Make code changes and refresh browser
  3. Once feature is finished or bug fixed, use jshint to lint code
  4. Fix lint issues then use Google Closure Compiler to minify
  5. 🍻

rellax's People

Contributors

moeamaya avatar p-realinho avatar yuanchuan avatar terwanerik avatar wyyz514 avatar olegtsaplin avatar nlemoine avatar imcodingideas avatar amdixon avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.