我在项目中使用缓存选择器以加快速度,同时看到了一些改进: (减少在文档内搜索的次数)
For my project, I use cached selectors to improve performance by reducing the number of searches performed within the document.
var sel1 = $('#selector1');
var sel2 = $('#selector2');
在这种情况下,我该如何使用缓存的选择器?例如:
$('#selector1, #selector2').fadeTo(300, 1, 'linear');
这只是为了完善我的代码。
Ty :)