diff --git a/src/core_prototype.js b/src/core_prototype.js index 94a159f..2a997a9 100644 --- a/src/core_prototype.js +++ b/src/core_prototype.js @@ -11,8 +11,13 @@ Superslides.prototype = { }, _upcomingSlide: function(direction, from_hash_change) { - if (from_hash_change && !isNaN(direction)) { - direction = direction - 1; + if (from_hash_change && (!!direction)) { + var index = this._findSlideById(direction); + if (index >= 0 && index < that.size()) { + return index; + } else { + return 0; + } } if ((/next/).test(direction)) { @@ -97,7 +102,8 @@ Superslides.prototype = { this.css.containers(); this.css.images(); - this.pagination._addItem(this.size()); + this.pagination._setup(); + this.start() this._findPositions(this.current); this.$el.trigger('updated.slides'); diff --git a/src/pagination.js b/src/pagination.js index 64f9258..cea8f08 100644 --- a/src/pagination.js +++ b/src/pagination.js @@ -18,6 +18,12 @@ var pagination = { href = slide_id; } + if (that.size() > 1){ + that.$pagination.css({display: 'block'}); + } else { + that.$pagination.css({display: 'none'}); + }; + var $item = $("", { 'href': "#" + href, 'text': href @@ -26,13 +32,18 @@ var pagination = { $item.appendTo(that.$pagination); }, _setup: function() { - if (!that.options.pagination || that.size() === 1) { return; } + if (!that.options.pagination) { return; } - var $pagination = $("