1
0
mirror of https://github.com/2ec0b4/kaamelott-soundboard.git synced 2025-12-08 23:53:24 +00:00

Révise l'affichage de l'infobulle donnant des informations sur les sons

This commit is contained in:
Antoine
2016-05-22 18:55:26 +02:00
parent 8c825ec5ef
commit 1b7327c34d
4 changed files with 43 additions and 2 deletions

View File

@@ -16,7 +16,9 @@ define(
soundItem: 'a'
},
events: {
'click @ui.soundItem': 'toggleSound'
'click @ui.soundItem': 'toggleSound',
'mouseenter @ui.soundItem': 'toggleSoundDetail',
'mouseleave @ui.soundItem': 'toggleSoundDetail'
},
initialize: function() {
this.listenTo(this.model, "change:playing", this.playingAttributeChanged);
@@ -40,6 +42,26 @@ define(
} else {
$(this.ui.soundItem).removeClass('playing');
}
},
toggleSoundDetail: function(e) {
var offset;
if (e.type === 'mouseleave') {
$('.tooltip').remove();
return;
}
offset = $(this.el).offset();
$('<div/>')
.addClass('tooltip')
.append(
$('<p/>').text(this.model.getSoundDetail())
)
.css({left: (offset.left+25)+'px', top: (offset.top+30)+'px'})
.appendTo('body')
.delay(1000)
.show(0);
}
});