Permalink
Browse files

Updating demo

  • Loading branch information...
1 parent aee1d4c commit 1745f929af1cffdf1a89f89d68d3f0a3e8919ba4 @finnsson committed Feb 17, 2013
Showing with 8 additions and 8 deletions.
  1. +1 −0 pagerjs.com/demo/demo.js
  2. +7 −8 pagerjs.com/demo/index.html
View
@@ -121,6 +121,7 @@ requirejs(['jquery', 'knockout', 'underscore', 'pager', 'bootstrap', 'hashchange
var loader = {};
var txt = $('<img src="ajax-loader.gif"/>');
loader.load = function () {
+ $(element).empty();
$(element).append(txt);
};
loader.unload = function () {
@@ -1020,28 +1020,27 @@ <h3 data-bind="text: name"></h3>
</div>
<pre data-bind="prettyprint: {}" class="prettyprint linenums">
-&lt;div data-bind="page: {id: 'Sabrepulse', title: 'Sabrepulse', loader: textLoader, sourceOnShow: 'https://embed.spotify.com/?uri=spotify:album:43tqiFDcU8JcMVSYj6NTi3'}"&gt;
+&lt;div data-bind="page: {id: 'Sabrepulse', title: 'Sabrepulse', loader: spinnerLoader, sourceOnShow: 'https://embed.spotify.com/?uri=spotify:album:43tqiFDcU8JcMVSYj6NTi3'}"&gt;
&lt;iframe width="300" height="380" frameborder="0" allowtransparency="true"&gt;&lt;/iframe&gt;
&lt;/div&gt;
</pre>
<p>where</p>
<pre data-bind="prettyprint: {}" class="prettyprint linenums">
-textLoader: function(page, element) {
+spinnerLoader: function(page, element) {
var loader = {};
- var txt = $("&lt;div&gt;&lt;/div>",
- {text: 'Loading ' + page.getValue().title}
- );
- loader.load = function() {
+ var txt = $('&lt;img src="ajax-loader.gif"/&gt;');
+ loader.load = function () {
+ $(element).empty();
$(element).append(txt);
};
- loader.unload = function() {
+ loader.unload = function () {
txt.remove();
};
return loader;
}
- </pre>
+</pre>
<p>
Here is an example where the load method never returns (so we can see the spinner).

0 comments on commit 1745f92

Please sign in to comment.