
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
A Ruby wrapper to integrate scrollReveal - A small library to create and maintain how elements fade in, triggered when they enter the viewport.
See the demo application in action.
Add the gem to the Gemfile:
gem "scrollreveal-rails"
Add ScrollReveal to your JS Append the following lines to your app/assets/javascripts/application.js file:
//= require scrollReveal
$(function() {
window.scrollReveal = new scrollReveal();
});
In your view *.html.erb
or *.html.haml
<!-- Reveal using defaults. -->
scroll_reveal content: 'Holla!'
But wait! Itβs more fun if you define your own reveal animation parameters, which you can do using using natural, declarative language:
<!-- Reveal using custom parameters. -->
scroll_reveal content: 'Foo', animation: 'enter left and move 50px over 1.33s'
scroll_reveal content: 'Bar', animation: 'enter from the bottom after 1s'
scroll_reveal content: 'Baz' animation: 'wait 2.5s and then ease-in-out 100px'
What you enter into the data-scrollReveal
attribute is parsed for specific words:
These specific keyword / value pairs allow you to describe basic reveal animation behavior.
keyword: enter
β Controls the vector origin of your reveal animation.
value: top
| right
| bottom
| left
Example:
<!-- Reveal your element with a downward motion. -->
scroll_reveal content: 'Foo', animation: 'enter top'
keyword: move
β The distance your revealing element travels.
value: [ integer ]px.
Example:
scroll_reveal content: 'Foo', animation: 'move 24px'
keyword: over
β The duration of your reveal animation.
value: [ decimal ]s
Example:
scroll_reveal content: 'Foo', animation: 'over 1.66s'
keyword: after/wait
β The duration before your reveal begins.
value: [ decimal ]s
Example:
<!-- Both are accepted. -->
scroll_reveal content: 'Mel', animation: 'after 0.33s'
scroll_reveal content: 'Mel', animation: 'wait 0.33s'
####Combining Keyword/Value Pairs You can easily combine the above pairs to create more dynamic reveal animations.
Example:
scroll_reveal content: 'Foo', animation: 'enter top move 50px'
scroll_reveal content: 'Bar', animation: 'enter top move 50px, after 0.3s'
scroll_reveal content: 'Baz', animation: 'enter top move 50px, after 0.6s'
scroll_reveal content: 'Mel', animation: 'enter top move 50px, after 0.9s'
####Passing Blocks You can easily pass a block too.
Example:
scroll_reveal animation: 'enter top move 50px' do
image_tag 'foo.jpg'
end
You can use conjoining filler words for more readable language.
from
the
and
then
but
with
,
Example:
<!-- These 4 lines are equivalent. -->
scroll_reveal content: 'Foo', animation: 'wait 0.3s, then enter left and move 40px over 2s'
scroll_reveal content: 'Bar', animation: 'enter from the left after 0.3s, move 40px, over 2s'
scroll_reveal content: 'Baz', animation: 'enter left move 40px over 2s after 0.3s'
scroll_reveal content: 'Mel', animation: 'enter left, move 40px, over 2s, wait 0.3s'
The gem itself is released under the MIT license
:pray:
FAQs
Unknown package
We found that scrollreveal-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.