mirror of
https://github.com/Noratrieb/slides.git
synced 2026-01-15 17:05:06 +01:00
hide address bar in mobile browsers, add apple web app meta
This commit is contained in:
parent
ec1c111359
commit
1013ff7ba5
4 changed files with 71 additions and 42 deletions
27
js/reveal.js
27
js/reveal.js
|
|
@ -10,6 +10,8 @@ var Reveal = (function(){
|
|||
var HORIZONTAL_SLIDES_SELECTOR = '#reveal .slides>section',
|
||||
VERTICAL_SLIDES_SELECTOR = '#reveal .slides>section.present>section',
|
||||
|
||||
IS_TOUCH_DEVICE = !!( 'ontouchstart' in window ),
|
||||
|
||||
// The horizontal and verical index of the currently active slide
|
||||
indexh = 0,
|
||||
indexv = 0,
|
||||
|
|
@ -111,8 +113,8 @@ var Reveal = (function(){
|
|||
}
|
||||
|
||||
if( config.mouseWheel ) {
|
||||
document.addEventListener('DOMMouseScroll', onDocumentMouseScroll, false); // FF
|
||||
document.addEventListener('mousewheel', onDocumentMouseScroll, false);
|
||||
document.addEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF
|
||||
document.addEventListener( 'mousewheel', onDocumentMouseScroll, false );
|
||||
}
|
||||
|
||||
if( config.rollingLinks ) {
|
||||
|
|
@ -122,6 +124,17 @@ var Reveal = (function(){
|
|||
|
||||
// Read the initial hash
|
||||
readURL();
|
||||
|
||||
// Set up hiding of the browser address bar
|
||||
if( navigator.userAgent.match( /(iphone|ipod|android)/i ) ) {
|
||||
// Give the page some scrollable overflow
|
||||
document.documentElement.style.overflow = 'scroll';
|
||||
document.body.style.height = '120%';
|
||||
|
||||
// Events that should trigger the address bar to hide
|
||||
window.addEventListener( 'load', removeAddressBar, false );
|
||||
window.addEventListener( 'orientationchange', removeAddressBar, false );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -147,6 +160,16 @@ var Reveal = (function(){
|
|||
delegate.call();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Causes the address bar to hide on mobile devices,
|
||||
* more vertical space ftw.
|
||||
*/
|
||||
function removeAddressBar() {
|
||||
setTimeout( function() {
|
||||
window.scrollTo( 0, 1 );
|
||||
}, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for the document level 'keydown' event.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue