2013-10-23 100 views
2

我是Cytoscape.js的新手。我設法創建了一個網絡。我想在鼠標懸停在節點上時將鼠標光標更改爲指針。基於我讀到的,我應該使用下面的代碼:當鼠標位於節點上時,如何將光標更改爲指針

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 

令我吃驚的是,遊標沒有改變。它保持相同的默認光標。我錯過了什麼?請幫忙。謝謝。

回答

0

由於跨瀏覽器的光標技術問題以及光標不適用於觸摸設備,Cy.js不再支持cursor屬性。

+0

好棒!我們需要這個。 –

1

放在一個輔助類包裝的DOM元素上或在畫布上用本身事件的Cytoscape:

cys.on('mouseover', 'node',() => $(targetElement).addClass('mouseover')); 
cys.on('mouseout', 'node',() => $(targetElement).removeClass('mouseover')); 

然後在CSS: .cysWrapper.mouseover { cursor: pointer; }

2
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'); 
        }); 
相關問題