How to add display:inline-block in a jQuery show() function?

后端 未结 12 2036
执念已碎
执念已碎 2020-12-02 17:38

I have some code like this:

function switch_tabs(obj) {
    $(\'.tab-content\').hide();
    $(\'.tabs a\').removeClass(\"selected\");

    var id = obj.attr(         


        
12条回答
  •  孤街浪徒
    2020-12-02 18:19

    Instead of show, try to use CSS to hide and show the content.

    function switch_tabs(obj) {
        $('.tab-content').css('display', 'none'); // you could still use `.hide()` here
        $('.tabs a').removeClass("selected");
        var id = obj.attr("rel");
    
        $('#' + id).css('display', 'inline-block');
        obj.addClass("selected");
    }
    

提交回复
热议问题