Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Touch-enable, smallify

  • Loading branch information...
commit 565cd5dbe08e559ea6c5d243658dfa8694c2a57e 1 parent 2a8e7e1
@tmcw authored
Showing with 21 additions and 23 deletions.
  1. +16 −19 big.js
  2. +5 −4 index.html
View
35 big.js
@@ -6,7 +6,7 @@ window.onload = function() {
for (var k = 0; k < s.length; k++) s[k].style.display = 'none';
}
- function g(n) {
+ function go(n) {
hide();
var i = 1000;
s[n].style.display = 'inline';
@@ -20,27 +20,24 @@ window.onload = function() {
window.location.hash = n;
}
- if (window.location.hash) {
- var c = parseInt(window.location.hash.substring(1), 10);
- if (!isNaN(c)) {
- cur = Math.max(Math.min(s.length - 1, c), 0);
- }
- }
-
- g(cur);
-
- window.onclick = function() {
- cur = Math.min(s.length - 1, ++cur);
- g(cur);
+ document.onclick = function() {
+ cur = ++cur % (s.length);
+ go(cur);
};
- window.onkeydown = function(e) {
+ document.onkeydown = function(e) {
if (e.which === 39) {
- cur = Math.min(s.length - 1, ++cur);
- g(cur);
- } else if (e.which === 37) {
- cur = Math.max(0, --cur);
- g(cur);
+ go(cur = Math.min(s.length - 1, ++cur));
+ }
+ if (e.which === 37) {
+ go(cur = Math.max(0, --cur));
}
};
+
+ if (window.location.hash) cur = Math.max(
+ Math.min(
+ s.length - 1,
+ parseInt(window.location.hash.substring(1), 10)), 0) || cur;
+
+ go(cur);
};
View
9 index.html
@@ -1,7 +1,8 @@
-<!DOCTYPE html><html><head><title></title><link href='big.css' rel='stylesheet' type='text/css' /><script src='big.js'></script></head><body>
+<!DOCTYPE html><html><head><title></title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /><link href='big.css' rel='stylesheet' type='text/css' /><script src='big.js'></script></head><body>
+<div>use &harr; to navigate</div>
<div>Big</div>
<div><em>Presentation software</em> for busy busy hackers</div>
-<div>text</div>
+<div>+text</div>
<div>as <em>big</em> as it can be</div>
<div>no config</div>
<div><em>4k</em></div>
@@ -9,7 +10,7 @@
<div><img src='http://farm3.static.flickr.com/2506/5757000880_509440308e_z.jpg' /></div>
<div>JS+CSS <a href='https://github.com/tmcw/big'>github.com/ tmcw/ big</a></div>
-<script type="text/javascript">
+<!--<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
@@ -21,4 +22,4 @@
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
-</script>
+</script>-->
Please sign in to comment.
Something went wrong with that request. Please try again.