'Hover is still active after action on the phone
EDIT: Anyone please?
I got this from somewhere but when I tap on it on the phone (on PC it's ok) it stays with hover attributes = no BG and black colour to the next website refresh:
HTML
<a id="back2Top" title="Top" href="#">➤</a>
CSS
#back2Top {
width: 40px;
line-height: 40px;
overflow: hidden;
z-index: 999;
display: none;
cursor: pointer;
transition: background-color 0.2s linear;
-moz-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-o-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
position: fixed;
bottom: 39px;
right: 0;
background-color: #8db500;
color: #fff;
text-align: center;
font-size: 30px;
text-decoration: none;
}
#back2Top:hover {
background-color: transparent;
color: #000;
}
@media only screen and (max-width: 767px) {
#back2Top {
bottom: 0px;
}}
And JS
$(window).scroll(function() {
var height = $(window).scrollTop();
if (height > 100) {
$('#back2Top').fadeIn();
$('.open').css('background', 'rgba(141, 181, 0, 0.5)'); //these 3 are for something different
$('.closed').css('background', 'rgba(201, 0, 10, 0.5)');
$('.warn').css('background', 'rgba(255, 113, 0, 0.5)');
} else {
$('#back2Top').fadeOut();
$('.open').css('background', 'rgba(141, 181, 0, 1)'); //these 3 are for something different
$('.closed').css('background', 'rgba(201, 0, 10, 1)');
$('.warn').css('background', 'rgba(255, 113, 0, 1)');
}
});
$(document).ready(function() {
$("#back2Top").click(function(event) {
event.preventDefault();
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
});
What is wrong there? Or what I did wrong? ×I don't know what to add more here, it won't let me post it because of mostly code.× Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
