есть код:
$.fn.imgNotes = function(n) {
if(undefined != n){
notes = n;
}
imgOffset = $(this).offset();
$(notes).each(function(){
appendnote(this);
});
$(this).hover(
function(){
$('.note').show();
},
function(){
$('.note').hide();
}
);
$('.note').hover(
function(){
$('.note').show();
$(this).next('.notep').show();
$(this).css("z-index", 10000);
},
function(){
$('.note').show();
$(this).next('.notep').hide();
$(this).css("z-index", 0);
}
);
}
function appendnote(note_data){
note_left = parseInt(imgOffset.left) + parseInt(note_data.x1);
note_top = parseInt(imgOffset.top) + parseInt(note_data.y1);
note_p_top = note_top + parseInt(note_data.height)+5;
note_area_div = $("<div class='note'></div>").css({ left: note_left + 'px', top: note_top + 'px', width: note_data.width + 'px', height: note_data.height + 'px' });
note_text_div = $('<div class="notep" >'+note_data.note+'</div>').css({ left: note_left + 'px', top: note_p_top + 'px'});
$('body').append(note_area_div);
$('body').append(note_text_div);
}
этот код берет переменную note = {"x1":"10","y1":"10","height":"150","width":"50","note":"This is a note"};
и показывает отметки на фото, а как написать функцию, чтобы она брала бы переменную note в качестве аргумента и показывала бы метку на фото?
что-нибудь такого вида: <span onmouseover="imagefild.showimgteg("x1":"10","y1":"10","height":"150","width":"50","note":"This is a note")" >
буду очень благодарен за помощь!
Комментарии
Вроде итак работает при наведении мыши, так как реагирует на hover, или я чего-то не понял, а где взглянуть, чтобы понять, как сейчас и как надо чтобы работало?
Да работает и сейчас, только необходимо сделать чтобы при наведнии на текст обернутый в что-то вроде этого
<span onmouseover="imagefild.showimgteg("x1":"10","y1":"10","height":"150","width":"50","note":"This is a note")" >
на изображений появлялась соответствующая метка, (текст этот при этом располагается вне изображения)