config option for disabling touch navigation (closes #299)
This commit is contained in:
parent
09bf962d32
commit
e62b0f8795
17
js/reveal.js
17
js/reveal.js
|
@ -34,6 +34,9 @@ var Reveal = (function(){
|
||||||
// Vertical centering of slides
|
// Vertical centering of slides
|
||||||
center: true,
|
center: true,
|
||||||
|
|
||||||
|
// Enables touch navigation on devices with touch input
|
||||||
|
touch: true,
|
||||||
|
|
||||||
// Loop the presentation
|
// Loop the presentation
|
||||||
loop: false,
|
loop: false,
|
||||||
|
|
||||||
|
@ -375,11 +378,14 @@ var Reveal = (function(){
|
||||||
*/
|
*/
|
||||||
function addEventListeners() {
|
function addEventListeners() {
|
||||||
|
|
||||||
|
window.addEventListener( 'hashchange', onWindowHashChange, false );
|
||||||
|
window.addEventListener( 'resize', onWindowResize, false );
|
||||||
|
|
||||||
|
if( config.touch ) {
|
||||||
document.addEventListener( 'touchstart', onDocumentTouchStart, false );
|
document.addEventListener( 'touchstart', onDocumentTouchStart, false );
|
||||||
document.addEventListener( 'touchmove', onDocumentTouchMove, false );
|
document.addEventListener( 'touchmove', onDocumentTouchMove, false );
|
||||||
document.addEventListener( 'touchend', onDocumentTouchEnd, false );
|
document.addEventListener( 'touchend', onDocumentTouchEnd, false );
|
||||||
window.addEventListener( 'hashchange', onWindowHashChange, false );
|
}
|
||||||
window.addEventListener( 'resize', onWindowResize, false );
|
|
||||||
|
|
||||||
if( config.keyboard ) {
|
if( config.keyboard ) {
|
||||||
document.addEventListener( 'keydown', onDocumentKeyDown, false );
|
document.addEventListener( 'keydown', onDocumentKeyDown, false );
|
||||||
|
@ -407,11 +413,14 @@ var Reveal = (function(){
|
||||||
function removeEventListeners() {
|
function removeEventListeners() {
|
||||||
|
|
||||||
document.removeEventListener( 'keydown', onDocumentKeyDown, false );
|
document.removeEventListener( 'keydown', onDocumentKeyDown, false );
|
||||||
|
window.removeEventListener( 'hashchange', onWindowHashChange, false );
|
||||||
|
window.removeEventListener( 'resize', onWindowResize, false );
|
||||||
|
|
||||||
|
if( config.touch ) {
|
||||||
document.removeEventListener( 'touchstart', onDocumentTouchStart, false );
|
document.removeEventListener( 'touchstart', onDocumentTouchStart, false );
|
||||||
document.removeEventListener( 'touchmove', onDocumentTouchMove, false );
|
document.removeEventListener( 'touchmove', onDocumentTouchMove, false );
|
||||||
document.removeEventListener( 'touchend', onDocumentTouchEnd, false );
|
document.removeEventListener( 'touchend', onDocumentTouchEnd, false );
|
||||||
window.removeEventListener( 'hashchange', onWindowHashChange, false );
|
}
|
||||||
window.removeEventListener( 'resize', onWindowResize, false );
|
|
||||||
|
|
||||||
if ( config.progress && dom.progress ) {
|
if ( config.progress && dom.progress ) {
|
||||||
dom.progress.removeEventListener( 'click', preventAndForward( onProgressClick ), false );
|
dom.progress.removeEventListener( 'click', preventAndForward( onProgressClick ), false );
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue