Module: LazyImgRails::ViewHelpers

Defined in:
lib/lazy_img_rails/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#image_tag_lazy(image_path, args = {}) ⇒ Object



3
4
5
6
7
8
# File 'lib/lazy_img_rails/view_helpers.rb', line 3

def image_tag_lazy image_path, args = {}
  options = ''
  args.each{|arg| options += "#{arg[0]}='#{arg[1]}'"}

  raw "<img data-src='#{image_path}' src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== onload=lzld(this) onerror=lzld(this) #{options} />"
end