jQuery在聚光灯后重置css

时间:2013-03-15 04:37:29

标签: jquery css function

我是jQuery的新手,所以我会尽力解释

所以我有一个聚光灯脚本,里面是一个按钮。我设法改变了字体大小,但当用户关闭聚光灯时,按钮字体大小仍然是“500%”相同的大小。如何将其更改回默认字体大小?

谢谢

jQuery(document).ready(function(){
    jQuery('#community-wrap .community-status').click(function(){
        jQuery("#community-wrap .community-status .button").css({"font-size":"500%"});
        jQuery(this).spotlight();

    });

});

2 个答案:

答案 0 :(得分:0)

您需要处理退出事件并自行重置:

jQuery(document).ready(function(){
    jQuery('#community-wrap .community-status').click(function(){
        jQuery("#community-wrap .community-status .button").css({"font-size":"500%"});
        jQuery(this).spotlight({
             onHide: function(){
                 jQuery("#community-wrap .community-status .button").css({"font-size":"100%"});
             }
        });

    });

});

答案 1 :(得分:0)

你的代码也有答案,你是如何关闭聚光灯的?如果您使用jquery关闭以下代码将重置您的按钮字体大小

$.('.close').click(function(){
$("#community-wrap .community-status .button").css({"font-size":"put-your default size"});
}