Showing Material Checkbox Animation On Hover

白昼怎懂夜的黑 提交于 2021-02-10 18:43:41

问题


Check out the effect at this link where the circular background of the checkbox is shown on hover. How can I get this same behavior while using <mat-checkbox> in Angular? I want the background to show on hover as well as the normal animation on transitions from checked to unchecked, unchecked to checked, etc. I am using @angular/material version 6.4.5. By inspecting the documentation for version 7.1.1, a persistent-ripple class is applied to a <div> inside the checkbox on hover. This does not happen in the documentation for version 6.4.7. The link for the older documentation is here.


回答1:


In css file, I have added the following code,

::ng-deep .mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple { opacity: .04; background: red($color: #000000);}

::ng-deep .mat-checkbox-inner-container:hover{ opacity: 1; background: red($color: #000000);}



来源:https://stackoverflow.com/questions/53620563/showing-material-checkbox-animation-on-hover

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!