Okej, to wrzucę ci wszystko bo nie jestem w stanie wytłumaczyć

kod d&d :
function itemEquip(item, slot) {
var oldItem = $(slot).find('id', 'class');
if (oldItem.length > 0) {
oldItem.appendTo('#bagpack').draggable({
revert: 'invalid'
});
}
var newItem = $('<div></div>');
newItem.attr('class', item.attr('class'))
.html(item.html())
.css('background',item.css('background'))
.appendTo(slot)
.draggable({
revert: 'invalid'
});
item.remove();
}
$(document).ready(function() {
$('#bagpack').droppable({
accept: '.item',
drop:function(e,ui){
if(ui.helper.hasClass('armor'))
$('.slot.armor').droppable('enable');
}
});
$('.slot.weapon').droppable({
accept: '.item.weapon'
});
$('.slot.armor').droppable({
accept: '.item.armor',
drop:function(){
$(this).droppable('disable');
}
});
$('.item').draggable({
revert: 'invalid'
});
$('#bagpack, .slot').bind('drop', function(ev, ui) {
itemEquip(ui.draggable, this);
});
});
kod tooltipa:
$(document).ready(function() {
$(".tip_trigger").hover(function(){
tip = $(this).find('.tip');
tip.show();
}, function() {
tip.hide();
}).mousemove(function(e) {
var mousex = e.pageX + 20;
var mousey = e.pageY + 20;
var tipWidth = tip.width();
var tipHeight = tip.height();
var tipVisX = $(window).width() - (mousex + tipWidth);
var tipVisY = $(window).height() - (mousey + tipHeight);
if ( tipVisX < 20 ) {
mousex = e.pageX - tipWidth - 20;
} if ( tipVisY < 20 ) {
mousey = e.pageY - tipHeight - 20;
}
tip.css({ top: mousey, left: mousex });
});
});
kod wyswietlania itema wraz z tooltipem:
echo '<span class="tip_trigger"><div id= "'.$przedmiot['id'].'" class="item '.$przedmiot['typ'].'" style="border: none; background: url('.$przedmiot['obrazek'].')"></div><span class="tip"><h3 class="tip_title">'.$przedmiot['nazwa'].'</h3><b>'.$title.'</b></span></span>';