Hello i need to highlight a div after my page is loading, i don't know if i should use a partial or something like that, the partial also has to have 2 variables disponible.
Code to highlight after loading by 5 seconds:
<div id="total_de_venta">
<% if @instalador.a_destajo? %>
<div align="right"><b>Total de la venta: $<%= @venta.precio_de_venta + @venta.precio_de_instalacion*2 %></b></div>
<% else %>
<div align="right"><b>Total de la venta: $<%= @venta.precio_de_venta + @venta.precio_de_instalacion*2 %></b></div>
<% end %>
</div>
controller :
def show
@venta = Venta.find(params[:id])
@este_instalador_id = @venta.instalador_id
@instalador = Instalador.find_by_id(@este_instalador_id)
#visual_effect(:highlight, "total_zone", :duration => 3.0)
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @project }
end
end
Can't you just do it by some Javascript only construction? I'm not a ruby programmer, but I'm sure you can add a 'onLoad' event to your page. The 'onLoad' event fires after the page is loaded. In the 'onLoad' handler you can add your desired effect, e.g. :
Effect.Highlight($('id_of_element'), [ your options]);
To add more than one 'onLoad' handler and execute them all, you can use the following Prototype function:
Event.observe(window, 'load', yourJavascriptFunction);