File tree Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Body Overflow
3
+ nav :
4
+ title : Demo
5
+ path : /demo
6
+ ---
7
+
8
+ <code src =" ../examples/body-overflow.tsx " ></code >
Original file line number Diff line number Diff line change
1
+ /* eslint no-console:0 */
2
+ import Trigger from 'rc-trigger' ;
3
+ import React from 'react' ;
4
+ import '../../assets/index.less' ;
5
+
6
+ export default ( ) => {
7
+ return (
8
+ < React . StrictMode >
9
+ < style
10
+ dangerouslySetInnerHTML = { {
11
+ __html : `
12
+ body {
13
+ overflow-x: hidden;
14
+ }
15
+ ` ,
16
+ } }
17
+ />
18
+
19
+ < Trigger
20
+ arrow
21
+ // forceRender
22
+ action = "click"
23
+ popup = {
24
+ < div
25
+ style = { {
26
+ background : 'yellow' ,
27
+ border : '1px solid blue' ,
28
+ width : 200 ,
29
+ height : 60 ,
30
+ opacity : 0.9 ,
31
+ } }
32
+ >
33
+ Popup
34
+ </ div >
35
+ }
36
+ popupStyle = { { boxShadow : '0 0 5px red' } }
37
+ popupAlign = { {
38
+ points : [ 'tc' , 'bc' ] ,
39
+ overflow : {
40
+ shiftX : 50 ,
41
+ adjustY : true ,
42
+ } ,
43
+ offset : [ 0 , - 10 ] ,
44
+ htmlRegion : 'scroll' ,
45
+ } }
46
+ >
47
+ < span
48
+ style = { {
49
+ background : 'green' ,
50
+ color : '#FFF' ,
51
+ paddingBlock : 30 ,
52
+ paddingInline : 70 ,
53
+ opacity : 0.9 ,
54
+ transform : 'scale(0.6)' ,
55
+ display : 'inline-block' ,
56
+ } }
57
+ >
58
+ Target
59
+ </ span >
60
+ </ Trigger >
61
+ </ React . StrictMode >
62
+ ) ;
63
+ } ;
Original file line number Diff line number Diff line change @@ -191,6 +191,10 @@ export default function useAlign(
191
191
} ;
192
192
193
193
( scrollerList || [ ] ) . forEach ( ( ele ) => {
194
+ if ( ele instanceof HTMLBodyElement ) {
195
+ return ;
196
+ }
197
+
194
198
const eleRect = ele . getBoundingClientRect ( ) ;
195
199
const {
196
200
offsetHeight : eleOutHeight ,
You can’t perform that action at this time.
0 commit comments