image popup js close button code example

Example: image popup js close button

$('.menu').mouseover(function(e) {
    console.log(e);
    var href = $(this).attr('href');
    var popup = $('
'); var image = $(''); popup.append(image); var text = $('

My Text

'); popup.append(text); var closeBtn = $(''); popup.append(closeBtn); popup.css('top', e.pageY + offsetY).css('left', e.pageX + offsetX); popup.append('body'); closeBtn.button().click(function() { $('#myPopup').remove(); }); }, function(e) { // do nothing });

Tags:

Misc Example