fix issue with click event target on overview slides

This commit is contained in:
Hakim El Hattab 2012-11-25 09:45:16 -05:00
parent e34ed3c2ff
commit 385bfd3717
2 changed files with 27 additions and 10 deletions

View File

@ -102,6 +102,9 @@ var Reveal = (function(){
// Delays updates to the URL due to a Chrome thumbnailer bug // Delays updates to the URL due to a Chrome thumbnailer bug
writeURLTimeout = 0, writeURLTimeout = 0,
// A delay used to ativate the overview mode
activateOverviewTimeout = 0,
// Holds information about the currently ongoing touch input // Holds information about the currently ongoing touch input
touch = { touch = {
startX: 0, startX: 0,
@ -575,10 +578,12 @@ var Reveal = (function(){
dom.wrapper.classList.add( 'overview' ); dom.wrapper.classList.add( 'overview' );
clearTimeout( activateOverviewTimeout );
// Not the pretties solution, but need to let the overview // Not the pretties solution, but need to let the overview
// class apply first so that slides are measured accurately // class apply first so that slides are measured accurately
// before we can positon them // before we can positon them
setTimeout( function(){ activateOverviewTimeout = setTimeout( function(){
var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR );
@ -643,6 +648,8 @@ var Reveal = (function(){
// Only proceed if enabled in config // Only proceed if enabled in config
if( config.overview ) { if( config.overview ) {
clearTimeout( activateOverviewTimeout );
dom.wrapper.classList.remove( 'overview' ); dom.wrapper.classList.remove( 'overview' );
// Select all slides // Select all slides
@ -651,6 +658,8 @@ var Reveal = (function(){
for( var i = 0, len = slides.length; i < len; i++ ) { for( var i = 0, len = slides.length; i < len; i++ ) {
var element = slides[i]; var element = slides[i];
element.style.display = '';
// Resets all transforms to use the external styles // Resets all transforms to use the external styles
element.style.WebkitTransform = ''; element.style.WebkitTransform = '';
element.style.MozTransform = ''; element.style.MozTransform = '';
@ -658,7 +667,7 @@ var Reveal = (function(){
element.style.OTransform = ''; element.style.OTransform = '';
element.style.transform = ''; element.style.transform = '';
element.removeEventListener( 'click', onOverviewSlideClicked ); element.removeEventListener( 'click', onOverviewSlideClicked, true );
} }
slide( indexh, indexv ); slide( indexh, indexv );
@ -1534,12 +1543,20 @@ var Reveal = (function(){
deactivateOverview(); deactivateOverview();
var h = parseInt( event.target.getAttribute( 'data-index-h' ), 10 ), var element = event.target;
v = parseInt( event.target.getAttribute( 'data-index-v' ), 10 );
while( element && !element.nodeName.match( /section/gi ) ) {
element = element.parentNode;
}
if( element.nodeName.match( /section/gi ) ) {
var h = parseInt( element.getAttribute( 'data-index-h' ), 10 ),
v = parseInt( element.getAttribute( 'data-index-v' ), 10 );
slide( h, v ); slide( h, v );
} }
} }
}
// --------------------------------------------------------------------// // --------------------------------------------------------------------//

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long