enhance popover behaviour

faster show/hide, no hide when hovering over the popover
This commit is contained in:
Felix Niklas 2015-01-14 22:59:56 +01:00
parent a3d2f3a768
commit 1a67de73cf
3 changed files with 32 additions and 4 deletions

View file

@ -233,7 +233,8 @@ class App.Controller extends Spine.Controller
trigger: 'hover' trigger: 'hover'
container: 'body' container: 'body'
html: true html: true
delay: { show: 400, hide: 800 } animation: false
delay: 100
placement: position placement: position
title: -> title: ->
ticket_id = $(@).data('id') ticket_id = $(@).data('id')
@ -270,7 +271,8 @@ class App.Controller extends Spine.Controller
trigger: 'hover' trigger: 'hover'
container: 'body' container: 'body'
html: true html: true
delay: { show: 400, hide: 800 } animation: false
delay: 100
placement: "auto #{position}" placement: "auto #{position}"
title: -> title: ->
user_id = $(@).data('id') user_id = $(@).data('id')
@ -326,7 +328,8 @@ class App.Controller extends Spine.Controller
trigger: 'hover' trigger: 'hover'
container: 'body' container: 'body'
html: true html: true
delay: { show: 400, hide: 800 } animation: false
delay: 100
placement: "auto #{position}" placement: "auto #{position}"
title: -> title: ->
organization_id = $(@).data('id') organization_id = $(@).data('id')
@ -379,7 +382,8 @@ class App.Controller extends Spine.Controller
trigger: 'hover' trigger: 'hover'
container: 'body' container: 'body'
html: true html: true
delay: { show: 500, hide: 5200 } animation: false
delay: 100
placement: "auto #{data.position}" placement: "auto #{data.position}"
title: -> title: ->
$(@).find('[title="*"]').val() $(@).find('[title="*"]').val()

View file

@ -0,0 +1,23 @@
/* from here http://jsfiddle.net/WojtekKruszewski/Zf3m7/22/ */
var originalLeave = $.fn.popover.Constructor.prototype.leave;
$.fn.popover.Constructor.prototype.leave = function(obj){
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
var container, timeout;
originalLeave.call(this, obj);
if(obj.currentTarget) {
container = $('body .popover');
timeout = self.timeout;
container.one('mouseenter', function(){
//We entered the actual popover call off the dogs
clearTimeout(timeout);
//Let's monitor popover content instead
container.one('mouseleave', function(){
$.fn.popover.Constructor.prototype.leave.call(self, self);
});
})
}
};

View file

@ -25,6 +25,7 @@
//= require ./app/lib/bootstrap/dropdown.js //= require ./app/lib/bootstrap/dropdown.js
//= require ./app/lib/bootstrap/tooltip.js //= require ./app/lib/bootstrap/tooltip.js
//= require ./app/lib/bootstrap/popover.js //= require ./app/lib/bootstrap/popover.js
//= require ./app/lib/bootstrap/popover-enhance.js
//= require ./app/lib/bootstrap/modal.js //= require ./app/lib/bootstrap/modal.js
//= require ./app/lib/bootstrap/tab.js //= require ./app/lib/bootstrap/tab.js
//= require ./app/lib/bootstrap/transition.js //= require ./app/lib/bootstrap/transition.js