鍍金池/ 問(wèn)答/HTML5  HTML/ 當(dāng)按鈕按下去後放入icon,但本身按鈕會(huì)變形

當(dāng)按鈕按下去後放入icon,但本身按鈕會(huì)變形

<button class="add_tab_v2" onclick="location.href='xxx.php';">←</button>
$(".add_tab_v2").click(function(e) {
    $(".add_tab_v2").html("<img class='iconBack' src='images/loading_v2.svg'>");
    document.getElementById(".add_tab_v2").disabled=true;
});

當(dāng)按下去後,丟了一張圖片給button
但這樣大小會(huì)變

clipboard.png
PS: 圖片越大,越變型
跟其他按鈕會(huì)不一樣
但我又不想限制按鈕本身的padding或?qū)挾?br>因?yàn)檫@會(huì)因?yàn)樽值亩喙讯菜拗?...

回答
編輯回答
離夢(mèng)

加個(gè)overflow:hidden試試

2017年1月15日 01:11
編輯回答
墨小羽

試試:

<button class="add_tab_v2">←</button>
$(".add_tab_v2").on(function(e) {
    setTimeout(function(){
        location.href='xxx.php';
    }, 3000);
    $(this)
        .text('')
        .css('background-image', 'url(images/loading_v2.svg)')
        .prop('disabled', true);
});
2017年10月17日 17:20