Display mobile info box at the correct position.

This commit is contained in:
Jim Driessen
2017-02-02 15:20:02 +01:00
parent e90cf4cdef
commit 2685a3c9cc

View File

@ -87,6 +87,8 @@ $(function () {
});
$(document).on('touchstart', '.artist, .title', function(){
noRemove = true;
setTimeout(function(){ noRemove = false; }, 500);
$('.song-info').remove();
var row = $(this).parent();
var timeLeft = row.find('.time-left');
@ -95,12 +97,14 @@ $(function () {
$('body').append('<span class="song-info">Requested By: ' + row.find('.requested-by').text() + '<br>' + text
+ '</span>');
var offset = row.offset();
$('.song-info').css('top', offset.top - $(document).scrollTop() + row.height())
$('.song-info').css('top', offset.top + row.height())
.css('left', offset.left).css('backgroundColor', '#EEEEEE').width(row.width() - 16);
});
$(document).on('click', '.song-info', function(){
$(this).remove();
$(document).on('click', function(){
if(!noRemove) {
$('.song-info').remove();
}
});
getSongs();