我是 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/