开发者

Customize jquery ui position collision?

开发者 https://www.devze.com 2023-04-01 04:06 出处:网络
I was wondering if it was possible to customize (send in a callback?) how the ui position utility handles a 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

精彩评论

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