I have a css after element that needs to function like a back to top of page button but for some reason the hover state and jQuery click function do not seem to work. Not sure if its maybe a syntax error that I am missing?
HTML
<div id="divMain">
::after
</div>
CSS:
#divMain:after { content: 'Back To Top'; position: relative; left: 93%; font-size: 16px; bottom: 30px; cursor: pointer; padding: 5px 10px; }
#divMain:after:hover { color: #b0f14f; }
JS/jQuery:
$('#divMain:after').click(function () {
$('html, body').animate({ scrollTop: 0 }, 'fast');
});