Fixed a lot of responsive problems.
- Fixed auth problem - Fixed BBCode and Markdown apparition in some unnecessary parts
This commit is contained in:
@@ -72,6 +72,7 @@ export default function hovercard(){
|
||||
Alpine.nextTick(() => {
|
||||
const card = document.querySelector('.hovercard');
|
||||
if (card) window.refreshIcons(card);
|
||||
this.updatePosition(this.anchorEl);
|
||||
});
|
||||
|
||||
} catch( error ){
|
||||
@@ -89,13 +90,26 @@ export default function hovercard(){
|
||||
const RECT = anchorEl.getBoundingClientRect();
|
||||
const SCROLL_X = window.scrollX;
|
||||
const SCROLL_Y = window.scrollY;
|
||||
const VIEWPORT_WIDTH = window.innerWidth;
|
||||
const VIEWPORT_HEIGHT = window.innerHeight;
|
||||
|
||||
let x = RECT.left + SCROLL_X;
|
||||
const CARD = document.querySelector('.hovercard');
|
||||
const WIDTH = CARD?.offsetWidth || 280;
|
||||
const HEIGHT = CARD?.offsetHeight || 320;
|
||||
|
||||
let x = RECT.right + SCROLL_X + 8;
|
||||
let y = RECT.bottom + SCROLL_Y + 8;
|
||||
|
||||
const WIDTH = 280;
|
||||
if( x + WIDTH > window.innerWidth ){
|
||||
x = window.innerWidth - WIDTH - 16;
|
||||
if( x + WIDTH > VIEWPORT_WIDTH - 8 && RECT.left + SCROLL_X - WIDTH - 8 >= 8 ){
|
||||
x = RECT.left + SCROLL_X - WIDTH - 8;
|
||||
} else {
|
||||
x = Math.max(8, Math.min(x, VIEWPORT_WIDTH - WIDTH - 8));
|
||||
}
|
||||
|
||||
if( y + HEIGHT > VIEWPORT_HEIGHT + SCROLL_Y - 8 && RECT.top + SCROLL_Y - HEIGHT - 8 >= 8 ){
|
||||
y = RECT.top + SCROLL_Y - HEIGHT - 8;
|
||||
} else {
|
||||
y = Math.max(8, Math.min(y, VIEWPORT_HEIGHT + SCROLL_Y - HEIGHT - 8));
|
||||
}
|
||||
|
||||
this.x = x;
|
||||
|
||||
Reference in New Issue
Block a user