Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Pozycja okienka pop Frameless
Forum PHP.pl > Forum > Przedszkole
master245
Jak zrobić, aby pozycja okienka zawsze była na środku ekranu względem lewo/prawo, niezależnie od wielkości monitora ?
Poniżej kod, który gdzieś znalazłem i aktualnie używam

  1. <script>
  2.  
  3. // Amazing Frameless Popup Window - Version I
  4. // (C) 2000 www.CodeLifter.com
  5. // Free for all users, but leave in this header
  6.  
  7. // set the popup window width and height
  8.  
  9. var windowW=500 // wide
  10. var windowH=310 // high
  11.  
  12. // set the screen position where the popup should appear
  13.  
  14. var windowX = 600 // from left
  15. var windowY = 200 // from top
  16.  
  17. // set the url of the page to show in the popup
  18.  
  19. var urlPop = "framles2.htm"
  20.  
  21. // set the title of the page
  22.  
  23. var title = "Mapa dojazdu do celu"
  24.  
  25. // set this to true if the popup should close
  26. // upon leaving the launching page; else, false
  27.  
  28. var autoclose = true
  29.  
  30. // ============================
  31. // do not edit below this line
  32. // ============================
  33.  
  34. s = "width="+windowW+",height="+windowH;
  35. var beIE = document.all?true:false
  36.  
  37. function openFrameless(){
  38. if (beIE){
  39. NFW = window.open("","popFrameless","fullscreen,"+s)
  40. NFW.blur()
  41. window.focus()
  42. NFW.resizeTo(windowW,windowH)
  43. NFW.moveTo(windowX,windowY)
  44. var frameString=""+
  45. "<html>"+
  46. "<head>"+
  47. "<title>"+title+"</title>"+
  48. "</head>"+
  49. "<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
  50. "<frame name='top' src='"+urlPop+"' scrolling=auto>"+
  51. "<frame name='bottom' src='about:blank' scrolling='no'>"+
  52. "</frameset>"+
  53. "</html>"
  54. NFW.document.open();
  55. NFW.document.write(frameString)
  56. NFW.document.close()
  57. } else {
  58. NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
  59. NFW.blur()
  60. window.focus()
  61. NFW.resizeTo(windowW,windowH)
  62. NFW.moveTo(windowX,windowY)
  63. }
  64. NFW.focus()
  65. if (autoclose){
  66. window.onunload = function(){NFW.close()}
  67. }
  68. }
  69.  
  70. </script>
  71. <center><a href="java script:openFrameless()"> <img src="www.google.pl" alt="Smapa" height="110" width="170"></a></center>
kapslokk
Kod
position: fixed;
top: 50%;
left: 50%;
margin-top: -połowa wysokości boksu;
margin-left: -połowa szerokości boksu;
master245
Tylko, gdzie to wstawić ?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.