使用方法
你只需在网站管理后台—》主题设置—》自定义代码—》自定义 javascript 代码,把下面的 js 代码复制粘贴到里面即可。
自定义 javascript 代码:
// FPS 帧开始
// by:墨攻博客-mogong.net
$('body').before('<div id="fps" style="z-index:10000;position:fixed;top:3;left:3;font-weight:bold;"></div>');
var showFPS = (function(){
var requestAnimationFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000/60);
};
var e,pe,pid,fps,last,offset,step,appendFps;
fps = 0;
last = Date.now();
step = function(){
offset = Date.now() - last;
fps += 1;
if( offset >= 1000 ){
last += offset;
appendFps(fps);
fps = 0;
}
requestAnimationFrame( step );
};
appendFps = function(fps){
console.log(fps+'FPS');
$('#fps').html(fps+'FPS');
};
step();
})();
// by:墨攻博客-mogong.net
// FPS 帧结束
效果图
![图片[1]-网站左上角添加 FPS 帧率显示-墨攻博客](https://mogong.net/wp-content/uploads/2026/04/8a352326f520260408202738.png)
感谢您的来访,获取更多精彩文章请收藏本站。
© 版权声明
THE END


我也是有底线哒~
暂无评论内容