We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d106992 commit 39fc78cCopy full SHA for 39fc78c
app/helpers/application_helper.rb
@@ -50,4 +50,16 @@ def using_scrivito?
50
def is_kata?
51
request.path.starts_with? "/kata"
52
end
53
+
54
+ # 画像を aFarkas/lazysizes 経由で遅延読み込みする
55
+ # cf. https://github.com/aFarkas/lazysizes
56
+ def lazy_image_tag(source, options={})
57
+ options['data-src'] = asset_path(source)
58
+ options['loading'] = 'lazy' # Optimize if available
59
+ options[:class].blank? ?
60
+ options[:class] = "lazyload" :
61
+ options[:class] = "lazyload #{options[:class]}"
62
63
+ image_tag('/spinner.svg', options)
64
+ end
65
0 commit comments