jQuery UI : posisi dialog

Oleh : Abah Razi

بسم الله الرحمن الرحيم

Kode yang kita gunakan untuk mengatur posisi sebuah dialog di jQuery UI tampak seperti ini :

1
$( ".selector" ).dialog({ position: { my: "left top", at: "left bottom", of: button } });

Secara default posisi adalah center window atau

1
{ my: "center", at: "center", of: window }

Contoh implementasinya seperti berikut :

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
$(function() {
 
$( "#dialogkeranjang" ).click(function() {
$( "#dialog" ).dialog( "open" );
});
 
$("#dialog").dialog({
    autoOpen: false,
    title: 'Keranjang Belanja',
    position: { my: "left top", at: "left top", of: "#dialogkeranjang" },
    draggable: false,
    width : 800,
    height : 300,
    resizable : true,
    modal : true,
});
  
});

Silahkan merujuk ke utilitas posisi di jQuery UI untuk mempelajari tentang posisi ini lebih lanjut, karena implementasinya sama.

About Reza Ervani 431 Articles
Adalah pendiri programming.rezaervani.com -

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.