Skip to content

Commit

Permalink
Added events for:
Browse files Browse the repository at this point in the history
- Popover hide/show
- Popover hide/show animation complete

Added option to override popover.
  • Loading branch information
gordonbrander committed Nov 26, 2011
1 parent f1b5b3d commit 8247b0c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions jquery.cf.popover.js
Expand Up @@ -17,7 +17,7 @@
this.opts = $.extend({}, this.opts, opts);
this.$trigger = $($trigger.get(0));

this.$popover = $(this.$trigger.attr('href'));
this.$popover = $(( this.opts.popover || this.$trigger.attr('href') ));

this.$popover
.prepend('<span role="presentation" class="before"/>')
Expand All @@ -32,7 +32,8 @@
my: 'center bottom',
at: 'center top',
offset: '0 0',
collision: 'flop flop'
collision: 'flop flop',
popover: null
},

/**
Expand Down Expand Up @@ -102,13 +103,19 @@

/* Method for showing the popover */
show: function (callback) {
this.$popover.fadeIn('medium', callback);
this.$popover.fadeIn('medium', $.proxy(function () {
this.$trigger.trigger('popover-show-animation-complete');
}, this));
this.pinToTarget();
this.$trigger.trigger('popover-show');
},

/* Method for hiding the popover */
hide: function (callback) {
this.$popover.fadeOut('fast', callback);
hide: function () {
this.$popover.fadeOut('fast', $.proxy(function () {
this.$trigger.trigger('popover-hide-animation-complete');
}, this));
this.$trigger.trigger('popover-hide-animation-complete');
},

/* Event handler for showing popover */
Expand Down

0 comments on commit 8247b0c

Please sign in to comment.