聚光灯后 jQuery 重置回 css

标签 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();

    });

});

最佳答案

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

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%"});
             }
        });

    });

});

关于聚光灯后 jQuery 重置回 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15424847/

上一篇:CSS目录问题

下一篇:jquery重置动画

相关文章:

javascript - 在多个事件上触发函数

javascript - 是否可以在表单提交时检测哪个输入字段无效?

python - sklearn ,更改 cross_val_score 中的默认参数

r - 无法在栅格堆栈上有趣地计算 R 中的像素回归

javascript - 带有无 ID 图像的可重用 React 复选框组件

检查函数中的指针地址和值

jQuery Accordion 面板不会折叠

javascript - Uncaught TypeError : app. all is not a function

html - 内含文字的 AMP 图片

html - 如何防止 html/css 上的文本大小增加