I have a button at the top right corner in my top navbar. That button simply opens up a mat menu. I want to open that mat menu at a specific position, say at the middle of the screen, how do I go about it?
I have tried this snippet of code below in the menuOpened()
and button's onClick()
method, nothing seems to be working and the top, height, width, etc are being overwritten when I open the mat menu.
menuOpened() {
console.log('Menu is open');
var x: HTMLElement = document.querySelector("div.cdk-overlay-connected-position-bounding-box");
console.log(x);
x.style.left= "50%";
x.style.top= "50%";
console.log(x.style.top);
console.log(x);
}