Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

echo_lazy_loader

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

echo_lazy_loader

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

EchoLazyLoader

Gem for lazily loading the images using Echo javascript library.

Installation

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

Usage

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>

Configuration

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.

Contributors

  1. Kinaan Khan Sherwani ( kinaan.khan@confiz.com )
  2. Usman Ali ( usman.ali@confiz.com)
  3. Ahmad Hussain ( ahmad.hussain@confiz.com)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 10 Dec 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc