rac3b3nn0n
rac3b3nn0n

Reputation: 881

jQuery ContextMenu doesnot appear fully if element is at the bottom of the page

Okay I guess the subject line explains most of it, put still I'll elaborate a little more. Okay here is the scenario,

I have a tree of elements (element names are obtained from a database so can be from none to 1000s), every element that is created comes with contextMenu functionality (i.e., you can right click on them to view a contextMenu with 4-5 actions). Now it seems to work fine if I scroll up and down the page, but some pages do not have scrollbars (as per the requirement of the project), hence if I click on the bottom most element to view list of actions in a contextMenu, all I see is half of the contextMenu and the remaining half goes out of the bounds of the browser window (Please see the image below),

enter image description here

My question is, is there a way to move the position of the contextMenu so that it always remains within bounds of the browser window. Looking forward to your replies and Help,

Kind Regards,

rac3B3nn0n

Upvotes: 4

Views: 3101

Answers (2)

wbdarby
wbdarby

Reputation: 1149

I had the same problem for a very large context menu (>50 elements). I solved it as follows:

<style type="text/css">
  .limit-context-size { max-height: 300px; overflow-y: scroll; }
</style>
...
$.contextMenu({
...
  className: "limit-context-size",
...
});

This causes the menu to scroll vertically. The 300px was picked based on the context menu font size.

Upvotes: 4

rac3b3nn0n
rac3b3nn0n

Reputation: 881

Thankyou all, Well I've figured it out. Actually it was my own fault, in order to fix position bug for IE6, I had changed a little code inside jquery.contextMenu.js, reimplemented that in a different way just worked for me.

Thank you all for all your help and effort

Regards, rac3B3nn0n

Upvotes: 0

Related Questions