I'm having trouble getting my CSS 3 button to operate properly. You can view the button at one of my project pages. The problem is that there's a second or so delay before the :active
CSS selector takes effect, making the button move slightly and changing the shadow; it didn't do this before. Here's the Sass code:
@mixin transition($type, $time, $ease) {
-webkit-transition: $type $time $ease;
transition: $type $time $ease;
}
@mixin border-radius($length) {
border-radius: $length;
-webkit-border-radius: $length;
-moz-border-radius: $length;
}
.project-download {
color: #000300;
background-color: #00910A;
padding: 10px;
position: relative;
text-align: center;
font-size: 24px;
font-weight: bold;
@include transition(background-color, 0.2s, linear);
@include border-radius(10px);
box-shadow:
1px 1px 0 0 #014D06,
2px 2px 0 0 #014D06,
3px 3px 0 0 #014D06,
4px 4px 0 0 #014D06,
5px 5px 5px 0 #000000;
-webkit-box-shadow:
1px 1px 0 0 #014D06,
2px 2px 0 0 #014D06,
3px 3px 0 0 #014D06,
4px 4px 0 0 #014D06,
5px 5px 5px 0 #000000;
-moz-box-shadow:
1px 1px 0 0 #014D06,
2px 2px 0 0 #014D06,
3px 3px 0 0 #014D06,
4px 4px 0 0 #014D06,
5px 5px 5px 0 #000000;
&:hover { background-color: #00B00C; }
&:active {
box-shadow: 1px 1px 5px 0 #000000;
-webkit-box-shadow: 1px 1px 5px 0 #000000;
-moz-box-shadow: 1px 1px 5px 0 #000000;
top: 4px;
left: 4px;
}
}
which translates in CSS to:
.project-download {
color: #000300;
background-color: #00910A;
padding: 10px;
position: relative;
text-align: center;
font-size: 24px;
font-weight: bold;
box-shadow:
1px 1px 0 0 #014D06,
2px 2px 0 0 #014D06,
3px 3px 0 0 #014D06,
4px 4px 0 0 #014D06,
5px 5px 5px 0 #000000;
-webkit-box-shadow:
1px 1px 0 0 #014D06,
2px 2px 0 0 #014D06,
3px 3px 0 0 #014D06,
4px 4px 0 0 #014D06,
5px 5px 5px 0 #000000;
-moz-box-shadow:
1px 1px 0 0 #014D06,
2px 2px 0 0 #014D06,
3px 3px 0 0 #014D06,
4px 4px 0 0 #014D06,
5px 5px 5px 0 #000000;
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-webkit-transition: background-color 0.2s linear;
transition: background-color 0.2s linear;
}
.project-download:active {
box-shadow: 1px 1px 5px 0 #000000;
-webkit-box-shadow: 1px 1px 5px 0 #000000;
-moz-box-shadow: 1px 1px 5px 0 #000000;
top: 4px;
left: 4px;
}
.project-download:hover { background-color: #00B00C; }
I've searched Google a bit with no luck. Any ideas?
EDIT: I solved the problem that Clicky was causing by using this JavaScript function:
function removeLinkListeners()
{
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++)
{
if (links[i].classList.contains('project-download-link'))
{
links[i].removeEventListener('mousedown', clicky.outbound);
}
}
}
And changing the initialisation script to this:
<script type="text/javascript">
try
{
clicky.init(234973);
window.onload = removeLinkListeners;
}
catch(e) {}
</script>
If you place your code in a jsfiddle example...
http://jsfiddle.net/zfFtv/
You will notice there is no delay. So I'm suspecting it's your javascript. Perhaps the getclicky code is not efficient and causes a delay when you click on it? Try disabling your js files one by one to pinpoint the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With