How can I change the background of a "position aware button"? for example using this snippet:
$(function() {
$('.btn-posnawr')
.on('mouseenter', function(e) {
var parentOffset = $(this).offset(),
relX = e.pageX - parentOffset.left,
relY = e.pageY - parentOffset.top;
$(this).find('span').css({top:relY, left:relX})
})
.on('mouseout', function(e) {
var parentOffset = $(this).offset(),
relX = e.pageX - parentOffset.left,
relY = e.pageY - parentOffset.top;
$(this).find('span').css({top:relY, left:relX})
});
$('[href=#]').click(function(){return false});
});
.btn-posnawr {
text-align: center;
text-decoration: none;
line-height: 80px;
color: #00c4ad;
position: relative;
display: block;
overflow: hidden;
width: 100%;
height: 80px;
max-width: 250px;
margin: 1rem auto;
text-transform: uppercase;
border: 1px solid #00c4ad;
}
.btn-posnawr span {
position: absolute;
display: block;
width: 0;
height: 0;
border-radius: 50%;
background-color: #00c4ad;
-webkit-transition: width 0.4s ease-in-out, height 0.4s ease-in-out;
transition: width 0.4s ease-in-out, height 0.4s ease-in-out;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
z-index: -1;
}
.btn-posnawr:hover {
color: #eee;
}
.btn-posnawr:hover span {
width: 225%;
height: 562.5px;
}
.btn-posnawr:active {
background-color: #00c4ad;
}
<a class="btn-posnawr" href="#">Position Aware<span></span></a>
If I assign a background color, the javascript effect is switched off.