LazyImgRails
Fork of https://github.com/angelodlfrtr/lazyloadjs
which use https://github.com/vvo/lazyload/ js lib
Installation
Add this line to your application's Gemfile:
gem 'lazy_img_rails'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install lazy_img_rails
Usage
Add lazyloadjs in Assets Pipeline (e.g. app/assets/javascripts/application.js
)
# Add it after all your others scripts
//= lazyload
Restart your application. Done.
This gem provides a helper that allows you to render <img>
tag
# image_tag_lazy 'image_url', *options
# eg
= image_tag_lazy image_url("my_logo.png"), style: "height: 200px;", alt: "My logo"
Contributing
- Fork it ( https://github.com/trrbl/lazy_img_rails/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request