Module: EchoLazyLoaderHelper

Defined in:
app/helpers/echo_lazy_loader_helper.rb

Instance Method Summary collapse

Instance Method Details

#echo_image_tag(src, options = {}) ⇒ Object



3
4
5
6
7
# File 'app/helpers/echo_lazy_loader_helper.rb', line 3

def echo_image_tag src,options = {}
	options.merge!({"data-echo" => path_to_image(src)})
	raw(image_tag(EchoLazyLoader::default_image,options))
	# TODO: add noscript
end

#echo_init(offest = EchoLazyLoader::offset, throttle = EchoLazyLoader::throttle) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/echo_lazy_loader_helper.rb', line 9

def echo_init(offest = EchoLazyLoader::offset, throttle = EchoLazyLoader::throttle)
	javascript_tag do
 			raw("
 				window.onload= function(){
 					Echo.init({
   					offset: #{offest},
   					throttle: #{throttle}
 					});
 				} ;")
 		end
end