diff options
author | Trent Richardson <trentdrichardson@gmail.com> | 2012-11-05 10:10:54 -0500 |
---|---|---|
committer | Trent Richardson <trentdrichardson@gmail.com> | 2012-11-05 10:10:54 -0500 |
commit | 205e1a37a97b9ceef515d51b452fac4674a0e918 (patch) | |
tree | 240bcf93457009f75b44109f1486487d0716f438 /jquery-impromptu.js | |
parent | 8d0eae1727143acc63f7b4cd50d135f631027c86 (diff) | |
download | jQuery-Impromptu-205e1a37a97b9ceef515d51b452fac4674a0e918.zip jQuery-Impromptu-205e1a37a97b9ceef515d51b452fac4674a0e918.tar.gz jQuery-Impromptu-205e1a37a97b9ceef515d51b452fac4674a0e918.tar.bz2 |
Enable width animation without container
Diffstat (limited to 'jquery-impromptu.js')
-rw-r--r-- | jquery-impromptu.js | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/jquery-impromptu.js b/jquery-impromptu.js index efaf776..bd8baf4 100644 --- a/jquery-impromptu.js +++ b/jquery-impromptu.js @@ -1,8 +1,8 @@ /*
* jQuery Impromptu
* By: Trent Richardson [http://trentrichardson.com]
- * Version 4.0.5
- * Last Modified: 08/15/2012
+ * Version 4.0.6
+ * Last Modified: 11/05/2012
*
* Copyright 2012 Trent Richardson
* You may use this project under MIT or GPL licenses.
@@ -50,6 +50,7 @@ title: $.prompt.options.title,
html: message,
buttons: $.prompt.options.buttons,
+ position: $.prompt.options.position,
focus: $.prompt.options.focus,
submit: $.prompt.options.submit
}
@@ -237,6 +238,12 @@ focus: 0,
useiframe: false,
top: '15%',
+ position: {
+ container: null,
+ x: null,
+ y: null,
+ arrow: null
+ },
persistent: true,
timeout: 0,
state: {
@@ -277,7 +284,8 @@ windowHeight = $(window).height(),
documentHeight = $(document).height(),
height = bodyHeight > windowHeight ? bodyHeight : windowHeight,
- top = parseInt($window.scrollTop(),10) + ($.prompt.options.top.toString().indexOf('%') >= 0? (windowHeight*(parseInt($.prompt.options.top,10)/100)) : parseInt($.prompt.options.top,10));
+ top = parseInt($window.scrollTop(),10) + ($.prompt.options.top.toString().indexOf('%') >= 0? (windowHeight*(parseInt($.prompt.options.top,10)/100)) : parseInt($.prompt.options.top,10)),
+ pos = $.prompt.states[$.prompt.currentStateName].position;
// This fixes the whitespace at the bottom of the fade, but it is
// inconsistant and can cause an unneeded scrollbar, making the page jump
@@ -307,9 +315,8 @@ });
// tour positioning
- if($.prompt.states[$.prompt.currentStateName].position.container){
- var pos = $.prompt.states[$.prompt.currentStateName].position,
- offset = $(pos.container).offset();
+ if(pos && pos.container){
+ var offset = $(pos.container).offset();
if($.isPlainObject(offset) && offset.top !== undefined){
$.prompt.jqi.css({
@@ -325,6 +332,19 @@ $('html,body').animate({ scrollTop: top }, 'slow', 'swing', function(){});
}
}
+ // custom state width animation
+ else if(pos && pos.width){
+ $.prompt.jqi.css({
+ position: "absolute",
+ left: '50%'
+ });
+ $.prompt.jqi.animate({
+ top: pos.y || top,
+ left: pos.x || '50%',
+ marginLeft: ((pos.width/2)*-1),
+ width: pos.width
+ });
+ }
// standard prompt positioning
else{
$.prompt.jqi.css({
|