AJAX loading notice based on Prototype

Loading Notice is a javascript plugin, built on Prototype, which automatically shows an indictor when a slow AJAX is under process. Basically, it’s like the “loading” div appears in gmail when busy. And when the users scroll or resize the window, it will still keep showing on the top of the page.

Check it out here: http://github.com/shaokun/loading_notice/tree/master

HOWTO

1. Install the plugin:

<pre> $ ruby script/plugin install git://github.com/shaokun/loading-notice.git $ rake loading_notice:install </pre>

2. Include the library into your project:

<pre> <%= javascript_include_tag 'prototype', 'loading_notice' %> <%= stylesheet_link_tag 'loading_notice' %> </pre>

3. Add a “loading” div and initialize a javascript object:

<pre> <div id="loading" style="display: none">Loading...</div>


4. That’s all!

Posted by Shaokun 20 Jul 2009 at 05:55AM


Comments

  1. adeh 20 Jul 2009 at 06:51AM
    Hey, what about making a rails helper so I can just do.
    <%=loading_notice('等一下')%>
  2. shaokun 21 Jul 2009 at 04:56AM
    yep, sounds like a good idea!

>