开发者

Customize jquery ui position collision?

I was wondering if it was possible to customize (send in a callback?) how the ui position utility handles a collision.

I'm writing a popup plugin and I have a triangular callout image I'd like to point from the popup to where the user clicked in order to spawn the popup. I'm using the position utility and if a popup collides with the side of the screen I have it flipping. However, now the callout attached to the popup开发者_Python百科 is on the wrong side. I'm wondering if I can wrap the callout-repositioning in with the collision reposition work. Thanks!


Just check your positions and plan for it accordingly...

Example, if it will go off the top of the screen... you can check if the position of the clicked element minus the height of your popup is less than 0, then place it below...you can apply the same concept to the other sides of the screen too. Basically check the position of the outside bound of your popup against the screen edges 0 or window height or width

Get window width and height for use

$(window).height();
$(window).width();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜