Added x button to msgs

This commit is contained in:
mrfry 2020-11-16 16:36:25 +01:00
parent ca916fe93a
commit 234654a2e4

View file

@ -2031,6 +2031,21 @@
} }
appedtTo.appendChild(mainDiv) // THE FINAL APPEND appedtTo.appendChild(mainDiv) // THE FINAL APPEND
const xButton = CreateNodeWithText(mainDiv, '❌', 'div')
const xButtonSize = 20
SetStyle(xButton, {
position: 'absolute',
height: xButtonSize + 'px',
top: 0,
width: xButtonSize + 'px',
left: width - xButtonSize + 'px',
cursor: 'pointer',
})
xButton.addEventListener('mousedown', e => {
e.stopPropagation()
mainDiv.parentNode.removeChild(mainDiv)
})
// setting some events // setting some events
// addEventListener(window, 'scroll', function () { // addEventListener(window, 'scroll', function () {
// mainDiv.style.top = (pageYOffset + startFromTop) + 'px'; // mainDiv.style.top = (pageYOffset + startFromTop) + 'px';