Skip to content

Commit 6bdeeb6

Browse files
committed
Display blank div for initial transition. Fixes #1.
1 parent 9168b44 commit 6bdeeb6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Photo.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
.photo .blurb {
1313
position: absolute;
1414
background-color: #d8d8d8;
15-
opacity: 0.8;
15+
opacity: 0;
1616
padding: 10px 5px;
1717
overflow-y: scroll;
1818
overflow-x: hidden;

src/Photo.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ const Photo = React.createClass({
2323
renderOverlay() {
2424
const {title, description, margin} = this.props;
2525

26+
// Display empty div for initial transition
27+
if (!this.img) {
28+
return (<div className="blurb" style={{opacity: 0}} />);
29+
}
30+
2631
// Retrieve position from element
2732
const rect = this.img.getBoundingClientRect();
2833
const top = rect.top;
@@ -55,7 +60,7 @@ const Photo = React.createClass({
5560
...(height ? {height} : null),
5661
...(margin ? {margin: margin + 'px'} : null),
5762
}} />
58-
{clickable && this.img && this.renderOverlay()}
63+
{clickable && this.renderOverlay()}
5964
</div>
6065
);
6166
},

0 commit comments

Comments
 (0)