Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
Scale custom cursor based on anchor/button size - Jquery & CSS - Squarespace

I'm new to stack overflow and very novice to all scripting so please forgive any errors in syntax or etiquette, I'm here to learn.

So I'm currently building a squarespace site and attempting to add some custom code. I am using some found jquery code to use a custom dot cursor that resizes when you hover over a link. It's working as intended, with the js injected into the site footer and custom css driving the style. See my site example here and here

Currently the cursor scales up to a specified size on hover (defined in the css), however I'm trying to figure out a way to change the scale/behavior of the cursor depending on the size/style/type of link. So for example, on a smaller link the dot scales less and on a larger button it scales more etc.

I have found a few things online that pretty much do what I want, but being new to all this I'm not sure how to apply the code given to make it work. This is close to what I'm after - https://github.com/gaoryrt/cursor-dot but I haven't been able to get that to work.

Any help or guidance would be hugely appreciated.

Here is my current JS -

 $( ( ) => {


$( 'body' ).prepend ( '<div class="cursor cursor-dot" style="left: 0px; top: 0px;">' );

$( window ).mousemove ( function ( e ) {

  $( '.cursor' ).css ( {
  
    left: e.pageX,
    top: e.pageY
    
    } );
    
  } );
  
$( window ).mousemove ( function ( e ) {

  $( 'a' ).on ( 'mouseenter', function ( ) {
    
    $( '.cursor' ).addClass ( 'active' );
    
    } );
    
  } );
  
$( window ).mousemove ( function ( e ) {

  $( 'a' ).on ( 'mouseleave', function ( ) {
  
    $( '.cursor' ).removeClass ( 'active' );
    
    } );
    
  } );
  
} );

And this is the CSS -

@media ( hover: none ){
  .cursor {


display: none !important;

} }
{
 cursor: none ;
}
.cursor {
  --size: 80px;
  height: var( --size );
  width: var( --size );
  border-radius: 50%;
  pointer-events: none;  
position: absolute;
 transform: translate( -50%, -50% );
  z-index: 99999999999;
  }
.cursor.cursor-dot { 
 background: #ffffff; 
mix-blend-mode: difference; 
transition: width 0.5s, height 0.5s, background-color 0.3s; 
transition-timing-function: ease-out; 
}
.cursor-dot.active {
  --size: 300px;
  background-color: #ffffff;
  }

I also have this in the page header injection to call in the JS -

<script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda