使用jss悬停时如何更改其他类的可见性

时间:2019-12-14 21:30:01

标签: javascript reactjs material-ui jss

我正在尝试用户界面反应

这是我的scss(将鼠标悬停在.content上,而.replyBtn可以看到:可见):

.content {
  &:hover {
    .replyBtn {
      visibility: visible
    }
  }
}

.replyBtn {
  visibility: hidden;
}

JSS:怎么样?

const useStyles = makeStyles(theme => ({
  content: {
    '&:hover': {
       // how to change reply btn visibility? 
    }
  },
  replyBtn: {
    visibility: hidden
  }
}));

谢谢

2 个答案:

答案 0 :(得分:0)

在此示例中,replyBtn是css类:

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>

答案 1 :(得分:0)

   content: {
    '&:hover $replyBtn': {
       visibilty: 'visible'
     }
  },
   replyBtn: {
    visibility: 'hidden'
   }

您应该看到以下内容:https://pantaley.com/blog/Start-your-JSS-journey-with-the-selectors-cheat-sheet/