English 中文(简体)
highlight div or p after loading
原标题:

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);
问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签