summaryrefslogtreecommitdiffstats
path: root/src/jquery-impromptu.js
diff options
context:
space:
mode:
authorTrent <trentdrichardson@gmail.com>2015-04-30 08:23:07 -0400
committerTrent <trentdrichardson@gmail.com>2015-04-30 08:23:07 -0400
commit292da8ed635bbb9c1ea09bb3c41f55f8a47e84a4 (patch)
tree2e5717c9b449ad5570c112d5a666264fab50228e /src/jquery-impromptu.js
parent51d09e09fc7533cf4b4b95c37edd68b6c897307a (diff)
downloadjQuery-Impromptu-292da8ed635bbb9c1ea09bb3c41f55f8a47e84a4.zip
jQuery-Impromptu-292da8ed635bbb9c1ea09bb3c41f55f8a47e84a4.tar.gz
jQuery-Impromptu-292da8ed635bbb9c1ea09bb3c41f55f8a47e84a4.tar.bz2
#61 - Add ability to open the prompt to a specific state: initialState option added
Diffstat (limited to 'src/jquery-impromptu.js')
-rw-r--r--src/jquery-impromptu.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/jquery-impromptu.js b/src/jquery-impromptu.js
index 9b1e1a6..f27500e 100644
--- a/src/jquery-impromptu.js
+++ b/src/jquery-impromptu.js
@@ -81,6 +81,7 @@
persistent: true,
timeout: 0,
states: {},
+ initialState: 0,
state: {
name: null,
title: '',
@@ -366,8 +367,10 @@
t.jqif[opts.show](opts.overlayspeed);
t.jqi[opts.show](opts.promptspeed, function(){
- var $firstState = t.jqi.find('.'+ opts.prefix +'states .'+ opts.prefix +'state').eq(0);
- t.goToState($firstState.data('jqi-name'));
+ t.goToState(
+ isNaN(opts.initialState) ? opts.initialState :
+ t.jqi.find('.'+ opts.prefix +'states .'+ opts.prefix +'state').eq(opts.initialState).data('jqi-name')
+ );
t.jqib.trigger('impromptu:loaded');
});