คำสั่งสร้าง popup อยู่ตรงกลางใช้กับ fire fox ไมไ่ด้ครับ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา คำสั่งสร้าง popup อยู่ตรงกลางใช้กับ fire fox ไมไ่ด้ครับ
คำสั่งสร้าง popup อยู่ตรงกลางใช้กับ fire fox ไมไ่ด้ครับ
ตามหัวข้อเลยนะครับ
1 2 3 4 5 6 | function popup(url,name,windowWidth,windowHeight){ myleft=(screen.width)?(screen.width-windowWidth)/2:100; mytop=(screen.height)?(screen.height-windowHeight)/2:100; properties = "width=" +windowWidth+ ",height=" +windowHeight; properties += ",scrollbars=yes, top=" +mytop+ ",left=" +myleft; window.open(url,name,properties); |
ใช้กับ fire fox ไมไ่ด้ครับผม

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
ความคิดเห็นที่
1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | <script type= 'text/javascript' src= "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script> <script type= "text/javascript" > jQuery.fn.center = function (init) { var dxcenter = this; if (!init) { dxcenter.css( 'margin-top' , $(window).height() / 2 - this.height() / 2); dxcenter.css( 'margin-left' , $(window).width() / 2 - this.width() / 2); //ถ้ามีการ resize ให้ทำการคำนวนใหม่ $(window).resize( function () { dxcenter.center(!init); }); } else { var marginTop = $(window).height() / 2 - this.height() / 2; var marginLeft = $(window).width() / 2 - this.width() / 2; marginTop = (marginTop < 0) ? 0 : marginTop; marginLeft = (marginLeft < 0) ? 0 : marginLeft; dxcenter.stop(); dxcenter.animate({ marginTop: marginTop, marginLeft: marginLeft }, 250, 'swing' ); } } $(document).ready( function () { $( '#wrapper' ).center(); }); </script> <style> #wrapper { border: 1px solid black; background-color: #E0E0EF; color:#FFFFFF; padding:15px; height:50px; width:650px; text-align:center; } </style> <div id= "wrapper" > <div id= "my-content" > <h1>อิหยังกะได้..แหม่นบ่อ ...!!</h1> </div> </div> |
ลองก้อบโค้ดไปวางไว้ในไฟล์ html แล้วลองรันดูครับ เผื่อได้ไอเดียอื่น

ขอบคุณทุกการสนับสนุน
![]()