Witam, posiadam gotowy kod który zamienia menu kontekstowe, zmodyfikowałem go tak aby tworzył rozwijane menu, ale w FireFoxie jest ono zawsze w lewym górnym rogu ekranu.
Myślę że ten fragment odpowiada za pozycję na ekranie:
<?php
IsMenu = 'yes';
//Find out how close the mouse is to the corner of the window
var rightedge= window.innerWidth-e.clientX;
var bottomedge= window.innerHeight-e.clientY;
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? document.body.scrollLeft+e.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth;
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? document.body.scrollLeft+e.clientX : window.pageXOffset+e.clientX;
//same concept with the vertical position
if (bottomedge<menuobj.offsetHeight)
menuobj.style.top=ie5? document.body.scrollTop+e.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight;
else
menuobj.style.top=ie5? document.body.scrollTop+e.clientY : window.pageYOffset+e.clientY;
menuobj.style.visibility="visible";
return false;
?>
Co w nim jest nie tak?
Pozdrawiam, WebNuLL(Babcia@Stefa)
Ten post edytował Babcia@Stefa 24.08.2008, 11:28:48