Use JavaScript to get user client resolution

xiaoxiao2021-03-06  61

I have made a web page navigation drop-down menu, can be generated quickly with Firework, only use the code to copy the code to the page, but the user-end resolution caused the movement of the drop-down menu, how to get on the 800 and 1024 menu Keep the correct display, modify one of the functions in the JS file, y is only changed, only change the X coordinate variables

Function mm_showmenu (Menu, X, Y, Child, Imgname) {if (! WINDOW.MMWROTEMENU) Return; mm_cleartimeout (); if (menu) {var obj = find (IMGNAME) || Document.Images [IMGNAME] || Document .LINKS [IMGNAME] || Document.Anchors [IMGNAME]; if (Window.Screen.width == 800 && window.screen.Height == 600) // Used to 800 * 600 Resolution Setting {x = MovexBysLicePos (X -100, obj); y = MoveyByslicepos (Y, OBJ);} if (window.screen.width == 1024 && window.screen.Height == 768) // 1024 Resolution setting {x = MovexByslicePos (x, obj ); Y = MoveyBySLICEPOS (Y, OBJ);}}}}} (document.Layers) {if (menu) {var l = menu.menulayer || menu; l.top = L.LEFT = 1; hideactivemenus (); if (this.visibility) l = this; window.activemenu = L;} else {var l = child;} if (! l) Return; for (var i = 0; i 0) mm_showmenu (null, "relative", " Relative ", L.Layers [I]);} if (l.parentlayer) {if (x! =" relative ") L.ParentLayer.Left = x || WINDOW.PAGEX || 0; if (l.ParentLayer.Left L.Clip.width> Window.innerWidth) L.ParentLayer.Left - = (L.ParentLayer.Left L. Clip.width - Window.innerWidth; if (y! = "relative") L.ParentLayer.top = Y || WINDOW.PAGEY || 0; if (l.ParentLayer.iscontainer) {l.Menu.xoffset = Window .pagexoffset; l.Menu.yoffset; l.paarentlayer.clip.width = window.activemenu.clip.width 2; l.parentlayer.clip.Height = window.activeMenu.clip.Height 2;

转载请注明原文地址:https://www.9cbs.com/read-117284.html

New Post(0)