我使用jQuery切换显示/隐藏按钮。有没有办法合并SVG图标(在这种情况下,Octicons)?
$(function () {
$('.show-button').click(function(){
$(this).text(function(i,old){
return old=='Show less' ? 'Show more {% octicon chevron-down height:25 class:"right left" aria-label:toggle %}' : 'Show less';
});
});
});
现在,这输出:
[ Show more <svg height="25" class="octicon octicon-chevron-down right left" aria-label="toggle"...]
谢谢!
答案 0 :(得分:1)
答案 1 :(得分:1)
你可以尝试一下!
$(function () {
$('.show-button').click(function(){
$(this).html(function(i,old){
return old=='Show less' ? 'Show more {% octicon chevron-down height:25 class:"right left" aria-label:toggle %}' : 'Show less';
});
});
});