cancel
Showing results for 
Search instead for 
Did you mean: 

On hover instead of 'click' header account links RWD theme magento 1.9.4

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

On hover instead of 'click' header account links RWD theme magento 1.9.4

Hi,

I would like to use hover instead of ''click'' to display the header-account drop down links. I added the javascript to the bottom of header.phtml

app\design\frontend\rwd\default\template\page\html\header.phtml

<script type="text/javascript">
    $j(document).ready(function(){
        $j(".skip-account").hover(function() {
            $j(this).addClass("skip-active");
            $j("#header-account").addClass("skip-active");
        }, function() {
            $j(this).removeClass("skip-active");
            $j("#header-account").removeClass("skip-active");
        });
        $j(".skip-content").hover(function() {
            $j(this).addClass("skip-active");
            $j(".skip-account").addClass("skip-active");
        }, function() {
            $j(this).removeClass("skip-active");
            $j(".skip-account").removeClass("skip-active");
        });
    });
</script>

But when I hover the head search box, there is a shadow under the search box. And when I hover the top nav menu, the background has also a shadow. Please advise. Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: On hover instead of 'click' header account links RWD theme magento 1.9.4

Hi @ruvaders 

 

You are facing this issue because skip-content class is being used on menu, search and the account dropdown. 

 

Try below customised code:

 

<script type="text/javascript">
    $j(document).ready(function(){
        $j(".skip-account").hover(function() {
            $j(this).addClass("skip-active");
            $j("#header-account").addClass("skip-active");
        }, function() {
            $j(this).removeClass("skip-active");
            $j("#header-account").removeClass("skip-active");
        });
        $j("#header-account").hover(function() {
            $j(this).addClass("skip-active");
            $j(".skip-account").addClass("skip-active");
        }, function() {
            $j(this).removeClass("skip-active");
            $j(".skip-account").removeClass("skip-active");
        });
    });
</script>

 

If you find this helpful, please Accept as solution and provide Kudos.

 

Thanks.

View solution in original post

2 REPLIES 2

Re: On hover instead of 'click' header account links RWD theme magento 1.9.4

Hi @ruvaders 

 

You are facing this issue because skip-content class is being used on menu, search and the account dropdown. 

 

Try below customised code:

 

<script type="text/javascript">
    $j(document).ready(function(){
        $j(".skip-account").hover(function() {
            $j(this).addClass("skip-active");
            $j("#header-account").addClass("skip-active");
        }, function() {
            $j(this).removeClass("skip-active");
            $j("#header-account").removeClass("skip-active");
        });
        $j("#header-account").hover(function() {
            $j(this).addClass("skip-active");
            $j(".skip-account").addClass("skip-active");
        }, function() {
            $j(this).removeClass("skip-active");
            $j(".skip-account").removeClass("skip-active");
        });
    });
</script>

 

If you find this helpful, please Accept as solution and provide Kudos.

 

Thanks.

Re: On hover instead of 'click' header account links RWD theme magento 1.9.4

Thank you.@khatri_gaurav It works. When I use a cell phone to access my site, I have to click the Account link twice to display the drop-down section. Is there any solution?