1
我創建一個簡單的提示系統,你可以將一個屬性的元素後: <div data-tooltip-content="testing out tooltip.">
選擇風格屬性的
(PS我使用SASS)
造型:
content: attr(data-tooltip-content)
color: white
background: black
padding: 5px
position: absolute
white-space: nowrap
border-radius: .20rem
margin-top: -2rem
z-index: 14000 !important
pointer-events: none
這些工具提示正在用於顯示卡上的信息。當用戶點擊它們時,這些卡片將被展開並摺疊。但是,當我現在在被點擊的卡的JavaScript中做el.style['z-index'] = '0';
。然後工具提示會被重疊,因爲工具提示的z-index已被JavaScript覆蓋,這導致工具提示與其他具有更高z-index的東西重疊。那麼是否有方法可以在javascript中更改工具提示的樣式