如何调整 twemoji 表情符号的大小?
How to resize twemoji emojis?
我正在使用 twemoji 在页面上设置表情符号的样式:
$(document).ready(function () {
document.body = twemoji.parse(document.body)
});
它工作正常,但是默认的表情符号变成了 72x72
:
<img draggable="false" class="emoji" alt="" src="https://twemoji.maxcdn.com/2/72x72/1f600.png">
我希望 twemoji 渲染 16x16
png 或 svg 图标。
文档没有明确说明如何更改图标大小,所以我尝试了类似的方法:
$(document).ready(function () {
document.body = twemoji.parse(document.body,
{size: 16}
)
});
但是 none 有效。我怎样才能解决这个问题?
您可以在 运行 parse() 方法之前设置默认大小:
$(document).ready(function () {
// Set the size of the rendered Emojis
// This can be set to 16x16, 36x36, or 72x72
twemoji.size = '36x36';
document.body = twemoji.parse(document.body);
});
归功于 this page for the tip (and to this simple google search 找到它!)。
我正在使用 twemoji 在页面上设置表情符号的样式:
$(document).ready(function () {
document.body = twemoji.parse(document.body)
});
它工作正常,但是默认的表情符号变成了 72x72
:
<img draggable="false" class="emoji" alt="" src="https://twemoji.maxcdn.com/2/72x72/1f600.png">
我希望 twemoji 渲染 16x16
png 或 svg 图标。
文档没有明确说明如何更改图标大小,所以我尝试了类似的方法:
$(document).ready(function () {
document.body = twemoji.parse(document.body,
{size: 16}
)
});
但是 none 有效。我怎样才能解决这个问题?
您可以在 运行 parse() 方法之前设置默认大小:
$(document).ready(function () {
// Set the size of the rendered Emojis
// This can be set to 16x16, 36x36, or 72x72
twemoji.size = '36x36';
document.body = twemoji.parse(document.body);
});
归功于 this page for the tip (and to this simple google search 找到它!)。