From 0edcf9021ece57d68f86e67188f2cb20c5bee473 Mon Sep 17 00:00:00 2001 From: Bartek Szopka Date: Wed, 4 Jan 2012 23:42:50 +0100 Subject: [PATCH] impressive step click support --- css/style.css | 3 ++- 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 () {