Skip to content

Commit 41e1d47

Browse files
committed
Updating; better, different image handling
1 parent 999c2b1 commit 41e1d47

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

big.css

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ body {
22
font-family: 'Helvetica';
33
letter-spacing:-5px;
44
background:#000;
5+
background-size:100%;
56
color:#fff;
67
margin:0;
78
padding:0;

big.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ window.onload = function() {
77
s[n].style.display = 'inline';
88
s[n].style.fontSize = i + 'px';
99
if (s[n].firstChild.nodeName === 'IMG') {
10-
s[n].style.right = 0;
11-
s[n].style.bottom = 0;
10+
document.body.style.backgroundImage = 'url(' + s[n].firstChild.src + ')';
11+
s[n].firstChild.style.display = 'none';
1212
} else {
13-
while (
14-
s[n].offsetWidth > window.innerWidth ||
15-
s[n].offsetHeight > window.innerHeight) {
16-
i -= 10;
17-
s[n].style.fontSize = i + 'px';
18-
}
13+
document.body.style.backgroundImage = '';
14+
}
15+
while (
16+
s[n].offsetWidth > window.innerWidth ||
17+
s[n].offsetHeight > window.innerHeight) {
18+
s[n].style.fontSize = (i -= 10) + 'px';
1919
}
2020
if (window.location.hash !== n) window.location.hash = n;
2121
}

big.quickstart.html

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
font-family: 'Helvetica';
44
letter-spacing:-5px;
55
background:#000;
6+
background-size:100%;
67
color:#fff;
78
margin:0;
89
padding:0;
@@ -45,15 +46,15 @@
4546
s[n].style.display = 'inline';
4647
s[n].style.fontSize = i + 'px';
4748
if (s[n].firstChild.nodeName === 'IMG') {
48-
s[n].style.right = 0;
49-
s[n].style.bottom = 0;
49+
document.body.style.backgroundImage = 'url(' + s[n].firstChild.src + ')';
50+
s[n].firstChild.style.display = 'none';
5051
} else {
51-
while (
52-
s[n].offsetWidth > window.innerWidth ||
53-
s[n].offsetHeight > window.innerHeight) {
54-
i -= 10;
55-
s[n].style.fontSize = i + 'px';
56-
}
52+
document.body.style.backgroundImage = '';
53+
}
54+
while (
55+
s[n].offsetWidth > window.innerWidth ||
56+
s[n].offsetHeight > window.innerHeight) {
57+
s[n].style.fontSize = (i -= 10) + 'px';
5758
}
5859
if (window.location.hash !== n) window.location.hash = n;
5960
}

index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
<div>as <em>big</em> as it can be</div>
77
<div>no config</div>
88
<div><em>1.5k</em></div>
9-
<div><em>images too</em></div>
10-
<div><img src='http://farm3.static.flickr.com/2506/5757000880_509440308e_z.jpg' /></div>
9+
<div><img src='http://farm3.static.flickr.com/2506/5757000880_509440308e_z.jpg' /> images too</div>
1110
<div>JS+CSS <a href='https://github.com/tmcw/big'>github.com/ tmcw/ big</a></div>
1211

1312
<script type="text/javascript">

0 commit comments

Comments
 (0)