diff options
author | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-01-04 23:42:50 +0100 |
---|---|---|
committer | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-01-04 23:42:50 +0100 |
commit | 0edcf9021ece57d68f86e67188f2cb20c5bee473 (patch) | |
tree | 4a6781c5624b96c99c3b7c1972f16039b9e5c88b | |
parent | 67eb225ee171dd08421db090a6ab5c319a389357 (diff) | |
download | impress.js-0edcf9021ece57d68f86e67188f2cb20c5bee473.tar.gz |
impressive step click support
-rw-r--r-- | css/style.css | 3 | ||||
-rw-r--r-- | js/impress.js | 17 |
2 files changed, 13 insertions, 7 deletions
diff --git a/css/style.css b/css/style.css index 80b2bf4..0a65340 100644 --- a/css/style.css +++ b/css/style.css @@ -408,15 +408,16 @@ a:hover { #overview { z-index: -1; + padding: 0; } /* on overview step everything is visible */ #impress.step-overview .step { opacity: 1; + cursor: pointer; } - /* * SLIDE STEP STYLES * diff --git a/js/impress.js b/js/impress.js index 3695984..dfbaaef 100644 --- a/js/impress.js +++ b/js/impress.js @@ -284,21 +284,26 @@ document.addEventListener("click", function ( event ) { // event delegation with "bubbling" - // check if event target (or any of its parents it a link) + // check if event target (or any of its parents is a link or a step) var target = event.target; - while ( (target.tagName != "A") && (target != document.body) ) { + while ( (target.tagName != "A") && + (!target.stepData) && + (target != document.body) ) { target = target.parentNode; } if ( target.tagName == "A" ) { var href = target.getAttribute("href"); - // if it's a link to presentation step, select this step - if ( href && href[0] == '#' && ( target = byId(href.slice(1)) ) ) { - select(target); - event.preventDefault(); + // if it's a link to presentation step, target this step + if ( href && href[0] == '#' ) { + target = byId( href.slice(1) ); } } + + if ( select(target) ) { + event.preventDefault(); + } }); var getElementFromUrl = function () { |