Giter VIP home page Giter VIP logo

enllax.js's Introduction

#Enllax.js : jQuery Parallax Scrolling Effect

An ultra-lightweight (~1kb) and super easy to use plugin for applying parallax scrolling effect to any scrolling element. You can set parallax scrolling effects to both foreground and background elements, and also in both directions (vertically or horizontally).

Parallax scrolling effect is never been easier

View Demo

How to Use:

1. At first include jQuery and jquery.enllax.js

<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="jquery.enllax.min.js"></script>

2. Activate the Plugin

//very simple activation
$(window).enllax();

//or
$('#some-id').enllax();  // This selector should be parent of parallax scrolling elements

Parallax Elements:


If you want your elements to scroll at a different speed, or you can say scroll with parallax effect, then this plugin made this super easy. All you have to do is to use data attributes on elements, where you want to add parallax scrolling effect.

Parallax scrolling effects can be in two types. One is background scrolling effect, and another is for foreground elements to scroll with different speed. In both types, you can apply effects in both directions (vertically and horizontally).

1. Parallax on Backgrounds:
To allow background image to move with different speed, just use a data attribute with a numeric value as a multiplier for scrolling speed. Less is slower, and 1 is normal. Here's an example:

<div data-enllax-ratio="0.5">...</div>

2. Parallax on Foreground Elements:
To add a different scrolling speed to any foreground element, you have to add another data attribute. And, the value for this attribute should be 'foreground'. Default value is 'background'. Here's an example:

<img src="path/to/image" data-enllax-ratio=".5" data-enllax-type="foreground" />

3. Parallax on Direction-ware:
Parallax effect can now be applied in both vertical and horizontal directions. You have to add another data attribute additionally. The value for this data attribute can be 'vertical' or 'horizontal'. And, default value is 'vertical'

<!-- background -->
<div data-enllax-ratio=".5" data-enllax-direction="horizontal">...</div>

<!-- foreground -->
<img src="path/to/image" data-enllax-ratio=".5" data-enllax-type="foreground" data-enllax-direction="horizontal" />

You can also use some default value for all parallax scrolling element

$(window).enllax({

//default values

// type can be defined as it is background parallax scrolling element or foreground scrolling element.
type: 'background',  // another value for type is 'foreground'.

ratio: 0.5,  // multiplier for scrolling speed. Less is slower. Default: '0'.

direction: 'vertical' // another value for direction is 'horizontal'.

});

Credit and License


This plugin is maintaining by MMK Jony, and is licensed under MIT.

enllax.js's People

Stargazers

Pujayana avatar Omar Pervez avatar Roman avatar Ivan Hanloth avatar Preston avatar  avatar Andreas.Jenke avatar Ferdi Sahin avatar Jonas H. avatar Chris Lee avatar A R SAURABH avatar Andy avatar Jun Hui Soo avatar Cassio Luciano da silva avatar KARA avatar Marty Knoll avatar Aditya Relangi avatar Andrii Hrushetskyi avatar Marc avatar André Philip avatar Søren Bonde avatar PixelApps avatar Matthew Uffalussy avatar koishi avatar  avatar Yannick Gauthier avatar Andrew Tebbott avatar Mohammed Saad avatar jaaaaa avatar Luke Sims avatar Y. L. Huang avatar Damian Tardencilla avatar Nico avatar Mahdi avatar Jay avatar Wuilfredo Azócar avatar ilker avatar Carlos Venegas Arrabé avatar Arman Hayrapetyan avatar  avatar  avatar Mike Breadwater avatar Serjoscha Bassauer @ STORMS|SOFTWARE avatar Henning Huth avatar Tom avatar Loris Nezan avatar  avatar Mitchell Breden avatar Vahid Ghaderi avatar Cécile Lebleu avatar Hedula avatar Daniel avatar Ryoichi avatar Akshay Jumbade avatar Adnan avatar Jessica Lin avatar Tommy Pengilley avatar Joelthorner avatar Fabio Pinto avatar Don Henton avatar Raju Ahmmed avatar Yihong Shi avatar  avatar Mayank Chauhan avatar Hamsterwork avatar 一蔚蓝 avatar Hirokazu Okawa avatar George avatar Unay Santisteban avatar Honchar Denys avatar Amit Kumar avatar  avatar DGolab avatar Joe avatar Seth Whitaker avatar Peter avatar  avatar piro[studio] avatar Bryce Jacobson avatar Michael Roskosch avatar Fadillah Bilqis avatar Hendrik Obermayer avatar Colin Reilly avatar Richard Hoffmann avatar Onur avatar  avatar Fuly avatar J.LEE avatar Tanuj Nagpal avatar Jeffrey Nijstad avatar Maotora ᕙ(⇀‸↼‶)ᕗ avatar PARAM MITTAL avatar Kris Bee avatar Marvin Escobar avatar Alexey Milov avatar  avatar Colin Smith avatar Doha Helmy avatar Kun R avatar  avatar

Watchers

 avatar Jonath Lee Eng Sing avatar James Cloos avatar Michael Roskosch avatar Matthew Uffalussy avatar Carabineiro avatar Roman F. avatar MMK Jony avatar Julkar Naen Nahian avatar Guilherme Mulinde da Silva avatar  avatar Markus Brendler avatar  avatar  avatar Nico avatar

enllax.js's Issues

Parallax lags in chrome (Mac OS).

This happens only when i use Mac OS. JQuery smooth scroll lib fixed it, but caused touchpad to act really weird so i had to dump that.

Work with webpack

Is it possible to make it run with ES6?
importing as:
// import $ from 'Jquery';

Attributes

Is this working without inline attributes? (data-enllax-ratio=".5" data-enllax-type="forground").

This code doesn't do much:
$('.parallax').enllax({
type: 'background', // 'foreground'
ratio: 0.5,
direction: 'vertical' // 'horizontal'
});

Item position changes on upon page reload

Hi. Thanks for the great script. I've noticed the position of parallax items changes when reloading the page, differing to their position from initial load of the page. Why is this and how can it be resolved?

Thanks

About dist folder

Hi @mmkjony ,
We are cdnjs team, we want to host this project in cdnjs.
We found there is dist folder on latest master branch but there is no dist folder in v1.0.1/1.1.0. How about we manually add v1.0.1/1.1.0 and if the latest release with dist folder will update automatically in cdnjs? Thank you.

cdnjs/cdnjs#8450
cdnjs/cdnjs#8460

Does not work with jQuery 3.3.1

<script src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
 crossorigin="anonymous"></script>

212 Uncaught TypeError: $(...).enllax is not a function

Transformation to a parallax foreground element?

How can I apply a transformation to a parallax foreground element?
When I apply the parallax effect to one of my elements which are rotated and fliped, they lose those properties, I understand that the plugin overwrites the transform style, but I cant think in a solution to have both cases of transformations, parallax and flip working together.

The plugin is great, it is awesome even if this can not be made, thanks for the contribution.

What is the correct way to implement it?

Hi, what is the correct way of implement Enllax?
I'm using it on a bottom section in background image, works, but the background image dont fit entirely the container ( i'm using a huge image of 1950px x 1234px ), using data-enllax-ratio="-0.2" but i adjusted the settings but always i see the background border, i'm missing something? I have background cover in my container.
I have to do some kind of calculation?

Adding a transparent colour over the background

Hello there, first of all thanks for this awesome plugin.

I'd like to ask this thing: How can I set a background colour over the parallax image?
I'm using often a text above the image and with bright pictures that text disappears.

Is that possible directly through the plugin, without adding extra html and css?
Thanks.

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.