Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit 0a47cc7

Browse files
committed
Add styles for IE<10 (no flexbox)
1 parent 9f4db71 commit 0a47cc7

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

src/react-image-lightbox.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
getWindowWidth,
1212
getWindowHeight,
1313
isInIframe,
14+
getIEVersion,
1415
} from './util';
1516
import {
1617
KEYS,
@@ -21,7 +22,18 @@ import {
2122
WHEEL_MOVE_Y_THRESHOLD,
2223
ZOOM_BUTTON_INCREMENT_SIZE,
2324
} from './constant';
24-
import styles from './style.scss';
25+
import baseStyles from './style.scss';
26+
27+
// Add fallback classes for browsers without flexbox support
28+
let styles = baseStyles;
29+
if (getIEVersion() < 10) {
30+
styles = {
31+
...styles,
32+
toolbarSide: `${styles.toolbarSide} ${styles.toolbarSideNoFlex}`,
33+
toolbarLeftSide: `${styles.toolbarLeftSide} ${styles.toolbarLeftSideNoFlex}`,
34+
toolbarRightSide: `${styles.toolbarRightSide} ${styles.toolbarRightSideNoFlex}`,
35+
};
36+
}
2537

2638
class ReactImageLightbox extends Component {
2739
constructor(props) {

src/style.scss

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ $toolbarHeight: 50px;
111111
margin: 0;
112112
}
113113

114+
.toolbarSideNoFlex {
115+
height: auto;
116+
line-height: $toolbarHeight;
117+
max-width: 48%;
118+
position: absolute;
119+
top: 0;
120+
bottom: 0;
121+
}
122+
114123
.toolbarLeftSide {
115124
padding-left: 20px;
116125
padding-right: 0;
@@ -119,12 +128,21 @@ $toolbarHeight: 50px;
119128
text-overflow: ellipsis;
120129
}
121130

131+
.toolbarLeftSideNoFlex {
132+
left: 0;
133+
overflow: visible;
134+
}
135+
122136
.toolbarRightSide {
123137
padding-left: 0;
124138
padding-right: 20px;
125139
flex: 0 0 auto;
126140
}
127141

142+
.toolbarRightSideNoFlex {
143+
right: 0;
144+
}
145+
128146
.toolbarItem {
129147
display: inline-block;
130148
line-height: $toolbarHeight;
@@ -181,36 +199,3 @@ $toolbarHeight: 50px;
181199
.outerAnimating {
182200
animation-name: closeWindow;
183201
}
184-
185-
// // Use fallback styles for browsers without flexbox support
186-
// if (Util.getIEVersion() < 10) {
187-
// styles.toolbar = {
188-
// background-color: rgba(0, 0, 0, 0.5);
189-
// position : absolute;
190-
// left : 0;
191-
// top : 0;
192-
// right : 0;
193-
// height : $toolbarHeight;
194-
// };
195-
196-
// styles.toolbarSide = {
197-
// line-height: $toolbarHeight;
198-
// position : absolute;
199-
// top : 0;
200-
// bottom : 0;
201-
// margin : 0;
202-
// max-width : 48%;
203-
// };
204-
205-
// styles.toolbarLeftSide = {
206-
// padding-left: 20px;
207-
// padding-right: 0;
208-
// left: 0;
209-
// };
210-
211-
// styles.toolbarRightSide = {
212-
// padding-left: 0;
213-
// padding-right: 20px;
214-
// right: 0;
215-
// };
216-
// }

0 commit comments

Comments
 (0)