Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Allow setting of breakpoint-specific speed values in JavaScript #227

Open
dnywh opened this issue Feb 12, 2021 · 0 comments

Comments

@dnywh
Copy link

dnywh commented Feb 12, 2021

Hi,

Rellax is great. Thanks for making it. I've just got a feature request that would reduce the amount of markup I need to write:

As well as setting breakpoint-specific speed values in HTML, could default breakpoint-specific speeds be set in JavaScript?

For example, instead of writing the below for multiple HTML elements that share the same speed value across breakpoints:

<div
 class="rellax"
 data-rellax-xs-speed="1.25" 
 data-rellax-mobile-speed="3"
 data-rellax-tablet-speed="5"
 data-rellax-desktop-speed="10">
    Stuff here
</div>

<!-- Repeat the above for each element that shares the same speed values -->

...could there be defaults set in the accompanying JavaScript like so:

const rellax = new Rellax(".rellax", {
    // This already works to set a default speed value to anything with the class ".relax"
    speed: 3,
    // This below doesn't work but would be nice to have
    xsSpeed: 1.25,
    mobileSpeed: 3,
    tabletSpeed: 5,
    desktopSpeed: 10
});

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant