Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS/DHTML] Menu
Babcia@Stefa
post
Post #1





Grupa: Zarejestrowani
Postów: 654
Pomógł: 17
Dołączył: 19.03.2006
Skąd: z kosmosu ;)

Ostrzeżenie: (0%)
-----


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:
  1. <?php
  2. IsMenu = 'yes';
  3. //Find out how close the mouse is to the corner of the window
  4. var rightedge= window.innerWidth-e.clientX;
  5. var bottomedge= window.innerHeight-e.clientY;
  6.  
  7. //if the horizontal distance isn't enough to accomodate the width of the context menu
  8. if (rightedge<menuobj.offsetWidth)
  9. //move the horizontal position of the menu to the left by it's width
  10. menuobj.style.left=ie5? document.body.scrollLeft+e.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth;
  11. else
  12. //position the horizontal position of the menu where the mouse was clicked
  13. menuobj.style.left=ie5? document.body.scrollLeft+e.clientX : window.pageXOffset+e.clientX;
  14.  
  15. //same concept with the vertical position
  16. if (bottomedge<menuobj.offsetHeight)
  17. menuobj.style.top=ie5? document.body.scrollTop+e.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight;
  18. else
  19. menuobj.style.top=ie5? document.body.scrollTop+e.clientY : window.pageYOffset+e.clientY;
  20.  
  21. menuobj.style.visibility="visible";
  22. return false;
  23. ?>


Co w nim jest nie tak?

Pozdrawiam, WebNuLL(Babcia@Stefa)

Ten post edytował Babcia@Stefa 24.08.2008, 11:28:48
Go to the top of the page
+Quote Post

Posty w temacie
- Babcia@Stefa   [JS/DHTML] Menu   24.08.2008, 09:11:29
- - WebCM   Użyj poniższego kodu do przechwytywania ...   26.08.2008, 08:54:16


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 27.09.2025 - 05:48