Answers for "image popup js close button"

0

image popup js close button

$('.menu').mouseover(function(e) {
    console.log(e);
    var href = $(this).attr('href');
    var popup = $('<div id="myPopup"></div>');

    var image = $('<img id="image" src="' + href + '"/>');
    popup.append(image);

    var text = $('<p>My Text</p>');
    popup.append(text);

    var closeBtn = $('<button>X</button>');
    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
});
Posted by: Guest on June-23-2020

Code answers related to "image popup js close button"

Code answers related to "Javascript"

Browse Popular Code Answers by Language