jquery-cluetip
jquery-cluetip copied to clipboard
the cluetip is positioned in the middle of the window when there is not enough space at mouse position
Let's say we have a grid of objects and an "Actions" column displayed at the end of each row. That column contains a button and when clicking the button a cluetip (with a list of actions) will be displayed under that button (with positionBy = 'bottomTop'). When there is enough space to the right of the mouse-click position, the cluetip is displayed correctly underneath the button. But when there is not enough space, then the cluetip is displayed on the same row but in the center of the window. I traced this to line number 332 inside jquery.cluetip.1.2.7.js, where it seems to be done intentionally: posX = (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0);
Is this really intentional? Or was it by mistake that the two use-cases were mixed-up in the same condition: if (posX < 0 || opts.positionBy == 'bottomTop' || opts.positionBy == 'topBottom')
Maybe there are some use-cases (like mine) where the user would prefer to see the cluetip very close to the mouse-click position. Do you think it is a valid requirement to add (yet another) option to the cluetip plugin for the developer to specify whether they want the tooltip to be displayed centrally or near the original position ? Or is it just that the condition for opts.positionBy == 'bottomTop' || opts.positionBy == 'topBottom' should be handled separately of the condition for posX < 0 ?
I wanted to offer you an example in jsfiddle to test the behaviour described above: http://jsfiddle.net/sorin_postelnicu/wUyFB/11/ But the actual behaviour in this fiddle is even more weird... Now the cluetip is displayed in a very weird position, even if I tried to allow for sufficient space next to the "Actions" link...
thanks for the report. and sorry for the delay in getting back to you. will try to look at it this weekend. buried with my day-job work.