Giter Site home page Giter Site logo

jquery-lazy-images's Introduction

Initializer Support

Jquery::LazyImages::Options.default_image = 'default_image_name'

jquery-lazy-images

jQuery plugin for lazy-loading of images. Why download what you can't see?

Updated to 1.8.2

Installation

Rails 3.1 or greater (with asset pipeline enabled)

The jquery.lazy-images files will be added to the asset pipeline and available for you to use.

Add the following line to both app/assets/javascripts/application.js and to app/assets/stylesheets/application.css

//= require jquery.lazy-images

Rails 3.0 or earlier (or without asset pipeline)

Support coming soon.

Usage

All images rendered with image_tag will automatically be lazy-loaded.

Images in email

Lazy-loading of images in email really doesn't work. We haven't thought of a performant way to automatically make these images eager-loading, so you'll need to change your image_tag's in your email templates to eager_image_tag's.

This dangerous command may help you with this:

  sed -i 's/image_tag/eager_image_tag/g' app/views/*_mailer/*

Acknowledgements

Thanks to Mika Tuupola for creating jquery.lazyload.js! This gem bundles that library, and he's done most of the hard work for us.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.