diff --git a/src/scrollable/scrollable.js b/src/scrollable/scrollable.js index 9fb60f1..b904259 100644 --- a/src/scrollable/scrollable.js +++ b/src/scrollable/scrollable.js @@ -141,6 +141,21 @@ return self; }, + addItemBefore: function(item) { + item = $(item); + + if (!conf.circular) { + itemWrap.prepend(item); + } else { + itemWrap.children("." + conf.clonedClass + ":first").after(item); + itemWrap.children("." + conf.clonedClass + ":last").replaceWith(item.clone().addClass(conf.clonedClass)); + } + + self.seekTo(self.getIndex() +1, 0); + + fire.trigger("onAddItemBefore", [item]); + return self; + }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { @@ -186,7 +201,7 @@ }); // callbacks - $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { + $.each(['onBeforeSeek', 'onSeek', 'onAddItem', 'onAddItemBefore'], function(i, name) { // configuration if ($.isFunction(conf[name])) { diff --git a/src/tabs/tabs.js b/src/tabs/tabs.js index e4f8586..4f6e1d7 100644 --- a/src/tabs/tabs.js +++ b/src/tabs/tabs.js @@ -276,7 +276,7 @@ }); // open initial tab - if (location.hash && conf.tabs == "a" && root.find("[href=" +location.hash+ "]").length) { + if (location.hash && conf.tabs == "a" && root.find("[href='" +location.hash+ "']").length) { self.click(location.hash); } else {