4
數據圖標
我有我的HTMLSetting元素使用JavaScript
<button id="play-pause" aria-hidden="true"></button>
以下按鈕元素在jQuery的ready事件,我運行下面的代碼:
$('#play-pause').attr('data-icon', '')
這會將HTML元素這個
<button id="play-pause" aria-hidden="true" data-icon=""></button>
其中在瀏覽器呈現這樣的(鉻穩定):
但是,如果我刪除的JavaScript代碼,請手動將HTML更改爲以下(這是同樣的事情作爲JS WAAS做),並刷新頁面:
<button id="play-pause" aria-hidden="true" data-icon=""></button>
那麼它呈現像這樣:
有什麼區別?
我懷疑這是無關緊要的,但這裏的CSS:
/* Use the following CSS code if you want to use data attributes for inserting your icons */
[data-icon]:before {
font-family: '45sound';
content: attr(data-icon);
speak: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
font-style:normal;
}
您使用jQuery UI的按鈕? –