File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 313
313
this . posted = true ;
314
314
if ( menu . offsetWidth ) menu . style . width = ( menu . offsetWidth + 2 ) + "px" ;
315
315
var x = event . pageX , y = event . pageY ;
316
+ var bbox = document . body . getBoundingClientRect ( ) ;
317
+ var styles = ( window . getComputedStyle ? window . getComputedStyle ( document . body ) : { marginLeft : "0px" } ) ;
318
+ var bodyRight = bbox . right - Math . min ( 0 , bbox . left ) + parseFloat ( styles . marginLeft ) ;
316
319
if ( ! x && ! y && "clientX" in event ) {
317
320
x = event . clientX + document . body . scrollLeft + document . documentElement . scrollLeft ;
318
321
y = event . clientY + document . body . scrollTop + document . documentElement . scrollTop ;
326
329
x = ( rect . right + rect . left ) / 2 + offsetX ;
327
330
y = ( rect . bottom + rect . top ) / 2 + offsetY ;
328
331
}
329
- if ( x + menu . offsetWidth > document . body . offsetWidth - this . margin )
330
- { x = document . body . offsetWidth - menu . offsetWidth - this . margin }
332
+ if ( x + menu . offsetWidth > bodyRight - this . margin )
333
+ { x = bodyRight - menu . offsetWidth - this . margin }
331
334
if ( MENU . isMobile ) { x = Math . max ( 5 , x - Math . floor ( menu . offsetWidth / 2 ) ) ; y -= 20 }
332
335
MENU . skipUp = event . isContextMenu ;
333
336
} else {
339
342
}
340
343
if ( ! MENU . isMobile ) {
341
344
if ( ( MENU . isRTL && x - mw - menu . offsetWidth > this . margin ) ||
342
- ( ! MENU . isRTL && x + menu . offsetWidth > document . body . offsetWidth - this . margin ) )
345
+ ( ! MENU . isRTL && x + menu . offsetWidth > bodyRight - this . margin ) )
343
346
{ side = "right" ; x = Math . max ( this . margin , x - mw - menu . offsetWidth + 6 ) }
344
347
}
345
348
if ( ! isPC ) {
You can’t perform that action at this time.
0 commit comments