jsvectormap icon indicating copy to clipboard operation
jsvectormap copied to clipboard

Universal positions of tooltips

Open Valentine13 opened this issue 3 years ago • 1 comments

Sorry, but one more question. I'm trying to make the tooltip contain an image and a lot of text - in short, the block has a fairly large width and height, but with the current tooltip coordinate calculation function, there are times when some of the content remains outside the screen. How to correctly recalculate the coordinates so that the tooltip always fits entirely? I did something like this, but this code works a little messy.

   if (map.tooltip.selector.style.display === 'block') {
                var left = event.pageX - 10 - map.tooltip.width() + 'px',
                top = event.pageY - 10 - map.tooltip.height() + 'px';
		if (event.pageY < map.tooltip.height()) {
			top = 0; 
		}
		if (event.pageX < map.tooltip.width()) {
			left = 0; 
		}
	        if (left < 0) {
                      left = 0;
                  }  
                  if (top < 0) {
                      top = 0;
                  }
                _this.tooltip.css({
                    left: left,
                    top: top
                });
    }

Valentine13 avatar Oct 29 '22 12:10 Valentine13

Hey @Valentine13 very sorry for the late response but I've been busy for the past months.

It would be great if you provided a pen at https://codepen.io (or anything else) that repreduces the issue plus an image of the issue if possible, so I can help.

themustafaomar avatar Jan 06 '23 19:01 themustafaomar

Since this issue hasn't seen any activity recently, I'm closing it.

Feel free to reopen if needed!

themustafaomar avatar Jun 28 '24 14:06 themustafaomar