我认为你正在使用的版本是不是最新的。您应该检查GitHub repository这是官方存储库的源代码。
从GitHub的版本使用jquery.ui.position从jQuery用户界面,它允许你指定要显示菜单相对的元素(“顶顶层”,“左下” ......),还允许碰撞检测。
从documentation:
When the positioned element overflows the window in some direction, move it to an alternative position. Similar to my and at, this accepts a single value or a pair for horizontal/vertical, eg. "flip", "fit", "fit flip", "fit none".
所以,你想用的插件是这样的:
$('#myelement').selectmenu({
...
position: {
my: "left top", // default
at: "left bottom", // default
// "flip" will show the menu opposite side if there
// is not enough available space
collision: "flip" // default is ""
}
});
检查_refreshPosition()
似乎不再存在以下question了类似的问题解释(方法原样但是选项的位置当然仍然存在)。
嗨,当我使用新的jquery.ui.select.js我得到这个错误:jquery.ui.select.js:46 - 未捕获TypeError:对象#
插件基于jQuery UI 1.9(仍在开发中),其中Widget Factory实现'_bind()'方法。你必须使用jQuery UI 1.9。 – 2012-01-27 11:04:18
当我使用这个版本的时候,会不会工作?因为我使用更多插件的UI ... – Maanstraat 2012-01-27 11:13:10