Jump to content

Custom Cursor / Mouse

Recommended Posts

Hi!, I have the code to change the cursor of my web page, but now I need that when the cursor is over a category or text it hovers. The effect I want is similar to this page https://rafalbojar.com/  . I also attach files of how the effect looks.

 

My website is https://www.diegphoto.com/ and the code that I already used is this: 

body, html, * {
     cursor: url(https://static1.squarespace.com/static/62ec9420d1df13083dc8f4ad/t/63a1bdedcf2ca4775ddbddbe/1671544301258/orange-circlepeque%C3%B1o2.png), auto !important;
   }

Thank you in advance!

Sin título.jpg

sdd.jpg

Link to comment
  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

20 hours ago, diegphoto said:

Hi!, I have the code to change the cursor of my web page, but now I need that when the cursor is over a category or text it hovers. The effect I want is similar to this page https://rafalbojar.com/  . I also attach files of how the effect looks.

 

My website is https://www.diegphoto.com/ and the code that I already used is this: 

body, html, * {
     cursor: url(https://static1.squarespace.com/static/62ec9420d1df13083dc8f4ad/t/63a1bdedcf2ca4775ddbddbe/1671544301258/orange-circlepeque%C3%B1o2.png), auto !important;
   }

Thank you in advance!

Sin título.jpg

sdd.jpg

I check that your cursor works properly now. Have you figured it out?

image.thumb.png.aa3ae038bd3e762f80c3955c40213068.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
1 hour ago, Beyondspace said:

I check that your cursor works properly now. Have you figured it out?

image.thumb.png.aa3ae038bd3e762f80c3955c40213068.png

I find in the forum another code that it has the hover effect. The problem is that the hover doesn't work in button forms. also when the cursor is on the white background of the contact form, it disappears. The page is https://www.diegphoto.com/contacto 

 

Here is the new code 

In Design > Custom CSS

@media ( hover: none ) {

  .cursor {
  
    display: none !important;
    
    }
  }

* {

  cursor: none;
  
  }

.cursor {

  --size: 10px;
  
  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: #ed4c00; /* This defines the color of the cursor */
  mix-blend-mode: screen; /* Delete this line if you dont want the circle to invert */
  transition: width 0.6s, height 0.6s, background-color 0.6s;
  transition-timing-function: ease-out;
  
  }

.cursor-dot.active {

  --size: 50px;
  
  background-color: #ed4c00;
  
  }

In Settings > Advanced > Code Injection > HEADER. 

<script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

In Settings > Advanced > Code Injection > FOOTER. 

<script>

  $( ( ) => {
  
    $( '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' );
        
        } );
        
      } );
      
    } );
    
  </script>

Thank you!

Link to comment
5 minutes ago, diegphoto said:

I find in the forum another code that it has the hover effect. The problem is that the hover doesn't work in button forms. also when the cursor is on the white background of the contact form, it disappears. The page is https://www.diegphoto.com/contacto 

 

Here is the new code 

In Design > Custom CSS

@media ( hover: none ) {

  .cursor {
  
    display: none !important;
    
    }
  }

* {

  cursor: none;
  
  }

.cursor {

  --size: 10px;
  
  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: #ed4c00; /* This defines the color of the cursor */
  mix-blend-mode: screen; /* Delete this line if you dont want the circle to invert */
  transition: width 0.6s, height 0.6s, background-color 0.6s;
  transition-timing-function: ease-out;
  
  }

.cursor-dot.active {

  --size: 50px;
  
  background-color: #ed4c00;
  
  }

In Settings > Advanced > Code Injection > HEADER. 

<script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

In Settings > Advanced > Code Injection > FOOTER. 

<script>

  $( ( ) => {
  
    $( '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' );
        
        } );
        
      } );
      
    } );
    
  </script>

Thank you!

Try modifying a little on your above code

<script>

  $( ( ) => {
  
    $( '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, input.button' ).on ( 'mouseenter', function ( ) {
        
        $( '.cursor' ).addClass ( 'active' );
        
        } );
        
      } );
      
    $( window ).mousemove ( function ( e ) {
    
      $( 'a, input.button' ).on ( 'mouseleave', function ( ) {
      
        $( '.cursor' ).removeClass ( 'active' );
        
        } );
        
      } );
      
    } );
    
  </script>

This is the difference between the previous code with new

image.png.bc372d3272260b1838a78821701844dd.png

Hope it makes sense

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
9 minutes ago, Beyondspace said:

Try modifying a little on your above code

<script>

  $( ( ) => {
  
    $( '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, input.button' ).on ( 'mouseenter', function ( ) {
        
        $( '.cursor' ).addClass ( 'active' );
        
        } );
        
      } );
      
    $( window ).mousemove ( function ( e ) {
    
      $( 'a, input.button' ).on ( 'mouseleave', function ( ) {
      
        $( '.cursor' ).removeClass ( 'active' );
        
        } );
        
      } );
      
    } );
    
  </script>

This is the difference between the previous code with new

image.png.bc372d3272260b1838a78821701844dd.png

Hope it makes sense

Yes! That solves the problem with form buttons. But there is still the problem that the mouse disappears on the white background of the contact. I think the problem is the 'mix-blend-mode: screen' but I don't know the solution.

I think it does not disappear but looks very transparent.

kkk.jpg

Edited by diegphoto
Link to comment

Try deleting this code

image.png.00ef8d8e80d575315da7c67a10f29fb5.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
  • 2 weeks later...
  • 3 months later...

Hi, I have tried to use your codes above but the standard "hand" cursor is visible when hovering over navigation, how can I fix this? I also want the colour change to be gradual and smooth like the cursor size transition, now it just changes instantly. How can I achieve this?

@Beyondspace

Thanks! 

Edited by TJC123
Link to comment
On 4/18/2023 at 9:51 PM, TJC123 said:

Hi, I have tried to use your codes above but the standard "hand" cursor is visible when hovering over navigation, how can I fix this? I also want the colour change to be gradual and smooth like the cursor size transition, now it just changes instantly. How can I achieve this?

Thanks! 

What is your site url? We can check easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.