Module: Apotomo::JavascriptGenerator::Jquery

Defined in:
lib/apotomo-animate/javascript_generator.rb

Instance Method Summary collapse

Instance Method Details

#animate(id, markup) ⇒ Object



22
23
24
25
26
27
# File 'lib/apotomo-animate/javascript_generator.rb', line 22

def animate(id, markup)
  wrapped_markup = "<div id=\"wrapper-#{id}\" style=\"opacity: 0\">#{markup}</div>"

  "#{element(id)}.replaceWith('#{escape(wrapped_markup)}');" +
  "#{element("wrapper-#{id}")}.animate({ 'opacity': 1}, 400);"
end

#animate_id(id, markup) ⇒ Object



28
29
30
# File 'lib/apotomo-animate/javascript_generator.rb', line 28

def animate_id(id, markup)
  animate("##{id}", markup)
end