Don't show the alert group link until user hover over it

This commit is contained in:
Łukasz Mierzwa
2017-04-08 11:28:37 -07:00
parent 7b22323977
commit 0a9ae793d5
4 changed files with 32 additions and 5 deletions

View File

@@ -22,7 +22,8 @@ var Alerts = (function() {
// called after group was rendered for the first time
Added() {
var groupID = '#' + this.id;
$.each($(groupID).find('[data-toggle=tooltip]'), function(i, elem) {
var group = $(groupID);
$.each(group.find('[data-toggle=tooltip]'), function(i, elem) {
$(elem).tooltip({
animation: false, // slows down tooltip removal
delay: {
@@ -33,6 +34,7 @@ var Alerts = (function() {
trigger: 'hover'
});
});
UI.SetupAlertGroupUI(group);
}
Update() {

View File

@@ -378,4 +378,5 @@ table.table.examples > tbody > tr td:first-child {
}
span.alert-group-link > a {
color: #fff;
opacity: 0;
}

View File

@@ -1,6 +1,8 @@
var UI = (function(params) {
// when user click on any alert label modal popup with a list of possible
// filter will show, this function is used to setup that modal
setupModal = function() {
$('#labelModal').on('show.bs.modal', function(event) {
Unsee.Pause();
@@ -35,13 +37,35 @@ var UI = (function(params) {
}
// each alert group have a link generated for it, but we hide it until
// user hovers over that group so it doesn't trash the UI
setupGroupLinkHover = function(elem) {
$(elem).on('mouseenter', function() {
$(this).find('.alert-group-link > a').finish().animate({
opacity: 100
}, 200);
});
$(elem).on('mouseleave', function() {
$(this).find('.alert-group-link > a').finish().animate({
opacity: 0
}, 200);
});
}
setupAlertGroupUI = function(elem) {
setupGroupLinkHover(elem);
}
init = function() {
setupModal();
}
return {
Init: init
Init: init,
SetupAlertGroupUI: setupAlertGroupUI
}
})();

File diff suppressed because one or more lines are too long