JGeer
JGeer

Reputation: 1852

Change onhover to onclick

I use this code inside our header to display our cart. Currently the dropdown is displayed on hover.

How can I modify this so that the dropdown is displayed onclick?

<a href="#header-cart" class="skip-link skip-cart <?php if($_cartQty <= 0): ?> no-count<?php endif; ?>">
    <span class="icon"></span>
    <span class="label"><?php echo $this->__('Cart'); ?></span>
    <span class="count"><?php echo $_cartQty; ?></span>
</a>

<div id="header-cart" class="block block-cart skip-content">
    <?php echo $this->getChildHtml('minicart_content');?>
</div>

Upvotes: 0

Views: 326

Answers (1)

Venkata Vamsy
Venkata Vamsy

Reputation: 92

Use this

<a href="#" class="skip-link skip-cart <?php echo $_cartQty <= 0 ? 'no-count' : ''?>">


$('a').on('click',function(){$(this).attr('href','#header-cart')});

Upvotes: 1

Related Questions