swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.25k stars 744 forks source link

Background layer is only initial browser window size that is in view. #685

Open ShaunMcGuile opened 5 years ago

ShaunMcGuile commented 5 years ago

The background layer is only the size of the visible window. This leads to issues when the page extends beyond the initial browser window. The extra page area beyond the initial window is clickable when it should not be.

Solution -

get the max page height and width and substitute it in to the function that sets up the transparent layer.

var maxHeight= Math.max( document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight ); var maxWidth= Math.max( document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth );

line 1185 - .css({height: $win.height(), width: $win.width(), display: 'block'}) then becomes -

.css({height: maxHeight, width: maxWidth, display: 'block'})

This cures the issue.

ShaunMcGuile commented 5 years ago

Is this being fixed?