Created
April 5, 2013 03:34
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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