jQuery nprogress.js Page Loading Progress Bar

Add-ons
2026-07-26 00:03 4 次浏览 • 0 次下载 6.5KB
jQuery nprogress.js Page Loading Progress Bar

The following explains how to use the methods. Open the Index.html page to see the results directly.

  • NProgress.start() ? Display the progress bar

  • NProgress.set(0.4) ? Set the percentage

  • NProgress.inc() ? Increment the progress slightly

  • NProgress.done() ? Complete the progress


Usage

You can also...

Add it wherever you make Ajax calls! Bind it to the jQuery ajaxStart and ajaxStop events.

You can create a beautiful progress bar even without Turbolinks/Pjax! Bind it to $(document).ready and $(window).load.


Plugin Configuration

Modify the minimum percentage using minimum.

1
NProgress.configure({ minimum: 0.1 });

You can modify the markup structure using template. To ensure the progress bar works correctly, an element with the role='bar' attribute is required.

1
2
3
NProgress.configure({
template: "..."
});

Adjust the animation settings using ease (a CSS easing value) and the animation speed using speed (in milliseconds).

1
NProgress.configure({ ease: 'ease', speed: 500 });

Want to disable progress increments? Set trickle to false.

1
NProgress.configure({ trickle: false });

You can adjust trickleRate (the amount added per increment) and trickleSpeed (the interval between increments, in milliseconds).

1
NProgress.configure({ trickleRate: 0.02, trickleSpeed: 800 });

Want to disable the progress spinner? Set showSpinner to false.

1
NProgress.configure({ showSpinner: false });


星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare