Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

click() at the top of span button doesn't work

Tags:

jquery

I've been trying to make buttons using the simple structure :

<a href="#/category/portfolio/" class="filter" data-filter="*">
<span class="button">Tout</span>
</a>

It works, except for the very top of the buttons. We can click on it, the CSS activates, but not the jQuery related.

http://jsfiddle.net/vqrdW/

Thanks for your help !

like image 246
Sylphe Avatar asked Feb 03 '26 04:02

Sylphe


2 Answers

The problem is with this rule:

.button:active { 
   position: relative; 
   top: 3px;
}

As the button moves down by 3 pixels, when the mouse button is released, the cursor is not over the button so the action is not registered. If you comment out this chunk of code you can see that it fixes the problem.

Try instead to come up with a different effect for when the button is pressed that does not move the button to one side or another.

like image 107
Behrang Avatar answered Feb 05 '26 22:02

Behrang


Add the padding on the a tag instead of the .button:

a.filter {
  padding: 8px 14px 10px;
}
like image 42
Lamariffic Avatar answered Feb 05 '26 22:02

Lamariffic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!