在成功()jQuery上切换背景图像

时间:2012-04-12 02:33:39

标签: jquery css addclass

这个问题现在已经固定

请参阅下面更新的css。

我目前有:

$("form#FanDetail").serialize(),
                    function(){
                        $('form#FanDetail').hide(function(){
                            $('div.success').fadeIn();
                            // setup for next tab: [about]
                            $('li#about').removeClass('selected').addClass('Unselected'); // remove about bg, replace with gray bgColor
                            $('li#contact').removeClass('Unselected').addClass('selected'); // add bg, replace with red bg
                        });

1 个答案:

答案 0 :(得分:1)

.selected.Unselected的Css如下:

    #editProfileNav ul li.selected{         /* here */
        width:86px;
        height:40px;
        padding:0px;
        margin:0 1px 0 0;
        background-image:url('../img/SeleBox.png');
        float:left;
        list-style-type:none;
        list-style:none;
    }

    #editProfileNav ul li.Unselected{
        width:86px;
        height:40px;
        padding:0px;
        margin:0 1px 0 0;
        background-image:url('../img/unSeleBox.png');
        float:left;
        list-style-type:none;
        list-style:none;
    }
    /*       was originally  using this and it was overwritting above css for `.unselected`                     
    #editProfileNav ul li a{
        width:86px;
        height:40px;
        padding:0;
        margin:0 1px 0 0;
        background-image:url('../img/SeleBox.png');
        float:left;
        list-style-type:none;
        list-style:none;
    }
    */

#editProfileNav ul li a{} 正在覆盖 #editProfileNav ul li.selected{} CSS,因为它是在Css文档中调用的最后一次。