Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change cursor to pointer when mouse is over a node

Tags:

cytoscape.js

I am new to Cytoscape.js. I've managed to create a network. I'd like to change mouse cursor to pointer when mouse is over a node. Based on what I read, I should use the following code:

style: cytoscape.stylesheet()
    .selector('node')
      .css({
          'content': 'data(name)',
          'text-valign': 'center',
          'color': 'white',
          'text-outline-width': 2,
          'text-outline-color': '#888',          
          'cursor': 'pointer'
       })

//other code omitted

To my surprise, the cursor did not change. It stayed the same default cursor. What did I miss? Please help. Thanks.

like image 892
user2909505 Avatar asked Oct 23 '13 03:10

user2909505


2 Answers

This worked for me :

cy.on('mouseover', 'node', function (evt) {                            
                        $('html,body').css('cursor', 'pointer');
                    } );

cy.on('mouseout', 'node', function (evt) {
                        $('html,body').css('cursor', 'default');
                    });
like image 83
Claudiu Avatar answered Oct 02 '22 14:10

Claudiu


Due to technical issues with the cursor across browsers and the fact that the cursor does not apply at all on touch devices, Cy.js no longer supports the cursor property.

like image 22
maxkfranz Avatar answered Oct 02 '22 14:10

maxkfranz