Skip to content

Instantly share code, notes, and snippets.

@yosiyuki
Created April 5, 2013 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosiyuki/5316413 to your computer and use it in GitHub Desktop.
Save yosiyuki/5316413 to your computer and use it in GitHub Desktop.
rails helper for jQuery lazy load plugin * http://www.appelsiini.net/projects/lazyload
module ApplicationHelper
def lazy_image_tag source, options = {}
options['data-original'] = source
if options[:class].blank?
options[:class] = "lazy"
else
options[:class] = options[:class].to_s + " lazy"
end
image_tag 'image_grey.jpg', options
end
end
@yosiyuki
Copy link
Author

yosiyuki commented Apr 5, 2013

  • put jquery.lazyload.js to app/assets/javascript
  • put 'image_grey.jpg' to app/assets/images
  • $('img.lazy').lazyload()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment