JQuery ContextMenu does not display fully if the item is at the bottom of the page

Well, I think the storyline explains most of this issue, posed a little more. Ok, here is the script,

I have a tree of elements (element names are obtained from the database, so they can be from none to 1000), each element created has contextMenu functionality (i.e. you can right-click on them to view contextMenu with 4 - 5 actions). Now it works fine if I scroll up and down, but some pages do not have scroll bars (as required by the project), so if I click on the bottom item to see a list of actions in the Menu context, all I see is this is half of the Menu context, and the remaining half goes beyond the borders of the browser window (see image below),

enter image description here

My question is is there a way to move the position of contextMenu so that it always stays within the browser window. We are waiting for your answers and inquiries,

Yours faithfully,

rac3B3nn0n

+4
source share
2 answers

I had the same problem for a very large context menu (> 50 items). 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 move vertically. 300px was selected based on the font size of the context menu.

+3
source

Thanks to everyone, well, I figured it out. Actually it was my own mistake, to fix the location error for IE6, I changed the code inside jquery.contextMenu.js, overriding that it just worked differently for me.

Thank you all for your help and efforts.

Regards, rac3B3nn0n

0
source

Source: https://habr.com/ru/post/1379156/


All Articles