Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Gem for lazily loading the images using Echo javascript library.
Add this line to your application's Gemfile:
gem 'echo_lazy_loader'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install echo_lazy_loader
Add the following to your app/assets/javascripts/application.js
:
//= require echo
To use minified version use this:
//= require echo.min
Use the following helper function instead of image_tag
for images that you want to lazily load
echo_image_tag src, options
This function takes same parameters as the image_tag
helper.
You will also have to call the following function ( prefereably in application layout ).
echo_init
If you want to apply lazy loading to images that donot show on scrolling but are swaped by some slider or filter layout , you can directly use this javascript code
<script type="text/javascript">
Echo.render();
</script>
you can use rails g echo_lazy_loader:config
that will generate echo_lazy_loader.rb
in project's initializer folder.
The configurable options ( with default values) are as follows.
default_image = "/assets/blankloading.gif"
offset= 100
throttle= 250
default_image
is the path to the image which you want to show when the actual image is loading .
offset
and throttle
are used by the Echo Library
and has been explained in its documentation .
You can also pass the offset
and throttle
while calling echo_init
. The values passed to the function will be used instead of those given in configuration file.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that echo_lazy_loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.