2010-09-28 80 views

回答

8

你是正確的,.position()是走在這裏,像這樣的方式:

​$("#dialog").dialog() 
      .parent() //remember .dialog() wraps the content in another <div> 
      .position({ my: 'center', at: 'center', of: '#parent' }); 
    //or just .position({ of: '#parent' }); 

在上面的#parent它的父元素選擇,you can give it a try here。你想要myat性質是center所以他們集中彼此的運算上面,那麼of選擇是父選擇你想在中心。

我指定了圖中所有的相關選項,但由於centermyat的默認值,您可以指定只需of就像我在上面的註釋行中所述。

+0

你讓它看起來很簡單!謝謝:) – Skilldrick 2010-09-28 19:30:08

+2

這些選項很有用,因爲我在實驗後意識到我實際上需要'我':'top'',因爲如果對話框太大,頂部會從頂部消失瀏覽器)。 – Skilldrick 2010-09-28 19:33:28

+0

@Skilldrick - 我想知道他們是否會對我有所幫助,我想更多的是爲未來的用戶找到這個,但他們幫助你,以及優秀的:) – 2010-09-28 19:36:18