Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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="#">&#10148;</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.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If I'm right then you're trying to make an icon to go to the Top. Here, I'm sharing a simple code for that, you'll understand easily.

window.onscroll = function () { myFunction() };

var goToTop = document.getElementById("goToTop");

function myFunction() {
  if (window.pageYOffset >= 30) {
    goToTop.classList.add("sticky")
  } else {
    goToTop.classList.remove("sticky");
  }
}
body{
height:1500px;
width:100vw;
}
.goToTop{
    height:69px;
    width:69px;
    border-radius: 50%;
    background:white;
    position:fixed;
    right:30px;
    bottom:20px;
    z-index:1000;
    display:none;
}
.goToTop img{
    width:70px;
}
.goToTop.sticky{
    display: inline-block;
}
<body id="body">
  <div class="goToTop" id="goToTop">
      <a href="#body">
        <img src="https://img.icons8.com/ios/50/000000/collapse-arrow--v1.png"/>
      </a>
  </div>
</body>

OR
If I'm wrong Or You want me to fix your code only, then let me know in the comments.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda