Skip to content

Commit

Permalink
impressive step click support
Browse files Browse the repository at this point in the history
  • Loading branch information
bartaz committed Jan 4, 2012
1 parent 67eb225 commit 0edcf90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
17 changes: 11 additions & 6 deletions js/impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 0edcf90

Please sign in to comment.