Skip to content

Commit c19c453

Browse files
committed
Refactor pager code in slideshow
1 parent 4566d9d commit c19c453

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

grid-spf/slideshow.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ $.widget( "spf.slideshow", {
1111
that.refresh();
1212
});
1313

14-
this.element.delegate("button", "click", function() {
14+
this.buttons = $( kite( "#controls-tmpl" )() ).insertBefore( this.element ).delegate("button", "click", function() {
1515
var method = $(this).data("page");
1616
var source = that.options.source;
1717
source[method]();
1818
source.refresh();
19-
});
19+
}).buttonset().find("button");
2020

2121
this.options.source.refresh();
2222
},
@@ -31,15 +31,14 @@ $.widget( "spf.slideshow", {
3131
this.element.empty();
3232
this.element.html( photosHtml.join("") );
3333

34-
var buttons = this.element.prepend( kite( "#controls-tmpl" ) ).find(".controls").buttonset().find("button");
35-
buttons.button("enable");
34+
this.buttons.button("enable");
3635

3736
var source = this.options.source;
3837
if (!source._skip) {
39-
buttons.slice(0, 2).button("disable")
38+
this.buttons.slice(0, 2).button("disable")
4039
}
4140
if (source._skip + source._take >= source.totalCount) {
42-
buttons.slice(2, 4).button("disable")
41+
this.buttons.slice(2, 4).button("disable")
4342
}
4443
}
4544
});

0 commit comments

Comments
 (0)