# Problem with show and hide div on mouse events

**URL:** <https://www.ruby-forum.com/t/problem-with-show-and-hide-div-on-mouse-events/117032>\
**Category:** Rails\
**Created:** [October 12, 2007, 8:28am UTC](https://www.ruby-forum.com/t/problem-with-show-and-hide-div-on-mouse-events/117032 "2007-10-12T08:28:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirankinuforu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/977dab/32.png) [@kirankinuforu](https://www.ruby-forum.com/u/kirankinuforu)\
**Post date:** [October 12, 2007, 8:28am UTC](https://www.ruby-forum.com/t/problem-with-show-and-hide-div-on-mouse-events/117032/1 "2007-10-12T08:28:52Z")

</div>

\*Problem with show and hide div on mouse  
events[http://www.ruby-forum.com/topic/127744#569797](http://www.ruby-forum.com/topic/127744#569797)  
\*

Hi,

Friends, I am new to Ruby On Rails, I want to implement show and hide  
div on mouseover and mouseout events, I have tried by various ways using  
.rjs(Ruby Javascript) and Ajax also but its not working smoothly as I  
want.

(I have created some Rss links and on mouseover event I want to show its  
related links in the div below and on mouseover event of the div below I  
want to hide the div.)

Please Help me give me proper solution, If I got any code it will be the  
best solution for me.

Regards,

Kiran P.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![kirankinuforu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/977dab/32.png) [@kirankinuforu](https://www.ruby-forum.com/u/kirankinuforu)\
**Post date:** [October 12, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/problem-with-show-and-hide-div-on-mouse-events/117032/2 "2007-10-12T17:00:09Z")

</div>

I’m using 2 partials and a remote function to do this. I’m sure you  
can modify this for what you need.

## layout.rhtml

 \<%= render 'home/hide\_menu' %\>
------------------------------
## \_hide\_menu.rhtml

## \<div onMouseover="\<%= remote\_function :update =\> ‘menu’, :url =\> {:controller =\> ‘home’, :action =\> ‘menu’}, :before =\> “Element.show(‘spinner’)”, :complete =\> “Element.hide(‘spinner’)” %\>" onClick="\<%= remote\_function :update =\> ‘menu’, :url =\> {:controller =\> ‘home’, :action =\> ‘menu’}, :before =\> “Element.show(‘spinner’)”, :complete =\> “Element.hide(‘spinner’)” %\>"\>Menu

## menu.rhtml

"Element.hide('spinner')" %\>"\> #my menu items go here
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
## home\_controller.rb

def menu  
render :layout=\>false  
end

## def hide\_menu render :layout=\>false end

---

<div class="post-metadata">

**Author:** ![kirankinuforu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/977dab/32.png) [@kirankinuforu](https://www.ruby-forum.com/u/kirankinuforu)\
**Post date:** [October 17, 2007, 9:41am UTC](https://www.ruby-forum.com/t/problem-with-show-and-hide-div-on-mouse-events/117032/3 "2007-10-17T09:41:14Z")

</div>

removed\_email\_address@domain.invalid wrote:

> I’m using 2 partials and a remote function to do this. I’m sure you  
> can modify this for what you need.

> ## home\_controller.rb
> 
> def menu  
> render :layout=\>false  
> end
> 
> ## def hide\_menu render :layout=\>false end

Thanks for the help I think it will definately useful for me…
