update code style to match rest of reveal.js, disable parallax by default #595
This commit is contained in:
1 parent
2fc0dfa8e1
commit
347a907041
5 files changed
+40
-38
No files matched your search
@@ -108,10 +108,10 @@ Reveal.initialize({
|
|||||||
|
|
||||||
// Transition style for full page backgrounds
|
// Transition style for full page backgrounds
|
||||||
backgroundTransition: 'default' // default/linear/none
|
backgroundTransition: 'default' // default/linear/none
|
||||||
|
|
||||||
// Parallax background image
|
// Parallax background image
|
||||||
parallaxBackgroundImage: '', // CSS syntax, e.g. "url('a.jpg')"
|
parallaxBackgroundImage: '', // CSS syntax, e.g. "url('a.jpg')"
|
||||||
|
|
||||||
// Parallax background size
|
// Parallax background size
|
||||||
parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px"
|
parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px"
|
||||||
|
|
||||||
@@ -307,13 +307,13 @@ If you want to use the parallax scrolling background, set the two following conf
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
|
|
||||||
// Parallax background image
|
// Parallax background image
|
||||||
parallaxBackgroundImage: '', // CSS syntax, e.g. "url('a.jpg')"
|
parallaxBackgroundImage: '', // CSS syntax, e.g. "url('a.jpg')"
|
||||||
|
|
||||||
// Parallax background size
|
// Parallax background size
|
||||||
parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px" - currently only pixels are supported (don't use % or auto)
|
parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px" - currently only pixels are supported (don't use % or auto)
|
||||||
|
|
||||||
// This slide transition gives best results:
|
// This slide transition gives best results:
|
||||||
transition: linear
|
transition: linear
|
||||||
|
|
||||||
|
|||||||
@@ -1405,6 +1405,7 @@ body {
|
|||||||
/*********************************************
|
/*********************************************
|
||||||
* PARALLAX BACKGROUND
|
* PARALLAX BACKGROUND
|
||||||
*********************************************/
|
*********************************************/
|
||||||
|
|
||||||
.reveal[data-parallax-background] {
|
.reveal[data-parallax-background] {
|
||||||
-webkit-transition: all 0.8s ease;
|
-webkit-transition: all 0.8s ease;
|
||||||
-moz-transition: all 0.8s ease;
|
-moz-transition: all 0.8s ease;
|
||||||
|
|||||||
+2
-2
@@ -367,8 +367,8 @@ function linkify( selector ) {
|
|||||||
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
|
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
|
||||||
|
|
||||||
// Parallax scrolling
|
// Parallax scrolling
|
||||||
parallaxBackgroundImage: "url('https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg')",
|
// parallaxBackgroundImage: "url('https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg')",
|
||||||
parallaxBackgroundSize: "2100px 900px",
|
// parallaxBackgroundSize: "2100px 900px",
|
||||||
|
|
||||||
// Optional libraries used to extend on reveal.js
|
// Optional libraries used to extend on reveal.js
|
||||||
dependencies: [
|
dependencies: [
|
||||||
|
|||||||
+30
-29
@@ -91,10 +91,10 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
// Transition style for full page slide backgrounds
|
// Transition style for full page slide backgrounds
|
||||||
backgroundTransition: 'default', // default/linear/none
|
backgroundTransition: 'default', // default/linear/none
|
||||||
|
|
||||||
// Parallax background image
|
// Parallax background image
|
||||||
parallaxBackgroundImage: '', // CSS syntax, e.g. "url('a.jpg')"
|
parallaxBackgroundImage: '', // CSS syntax, e.g. "url('a.jpg')"
|
||||||
|
|
||||||
// Parallax background size
|
// Parallax background size
|
||||||
parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px"
|
parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px"
|
||||||
|
|
||||||
@@ -475,24 +475,24 @@ var Reveal = (function(){
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Add parallax background if specified so
|
// Add parallax background if specified so
|
||||||
var parallaxBackgroundImage = config.parallaxBackgroundImage,
|
var parallaxBackgroundImage = config.parallaxBackgroundImage,
|
||||||
parallaxBackgroundSize = config.parallaxBackgroundSize;
|
parallaxBackgroundSize = config.parallaxBackgroundSize;
|
||||||
|
|
||||||
if (parallaxBackgroundImage) {
|
if( parallaxBackgroundImage ) {
|
||||||
dom.wrapper.style.background = parallaxBackgroundImage;
|
dom.wrapper.style.background = parallaxBackgroundImage;
|
||||||
dom.wrapper.style.backgroundSize = parallaxBackgroundSize;
|
dom.wrapper.style.backgroundSize = parallaxBackgroundSize;
|
||||||
|
|
||||||
// Make sure the below properties are set on the element - these properties are
|
// Make sure the below properties are set on the element - these properties are
|
||||||
// needed for proper transitions to be set on the element via CSS. To remove
|
// needed for proper transitions to be set on the element via CSS. To remove
|
||||||
// annoying background slide-in effect when the presentation starts, apply
|
// annoying background slide-in effect when the presentation starts, apply
|
||||||
// these properties after short time delay
|
// these properties after short time delay
|
||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
dom.wrapper.setAttribute('data-parallax-background', parallaxBackgroundImage);
|
dom.wrapper.setAttribute( 'data-parallax-background', parallaxBackgroundImage );
|
||||||
dom.wrapper.setAttribute('data-parallax-background-size', parallaxBackgroundSize);
|
dom.wrapper.setAttribute( 'data-parallax-background-size', parallaxBackgroundSize );
|
||||||
}, 1 );
|
}, 1 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1495,31 +1495,32 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
// Store references to the previous and current slides
|
// Store references to the previous and current slides
|
||||||
currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide;
|
currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide;
|
||||||
|
|
||||||
// Animate parallax background
|
// Animate parallax background
|
||||||
if (dom.wrapper.getAttribute('data-parallax-background') || config.parallaxBackgroundImage) {
|
if( dom.wrapper.getAttribute( 'data-parallax-background' ) || config.parallaxBackgroundImage ) {
|
||||||
var bs = dom.wrapper.style.backgroundSize.split(' '),
|
var bs = dom.wrapper.style.backgroundSize.split( ' ' ),
|
||||||
bgWidth, bgHeight;
|
bgWidth, bgHeight;
|
||||||
|
|
||||||
if (bs.length === 1) {
|
if( bs.length === 1 ) {
|
||||||
bgWidth = bgHeight = parseInt(bs[0], 10);
|
bgWidth = bgHeight = parseInt( bs[0], 10 );
|
||||||
} else {
|
|
||||||
bgWidth = parseInt(bs[0], 10);
|
|
||||||
bgHeight = parseInt(bs[1], 10);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
bgWidth = parseInt( bs[0], 10 );
|
||||||
var slideWidth = parseInt(dom.wrapper.offsetWidth, 10);
|
bgHeight = parseInt( bs[1], 10 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var slideWidth = dom.wrapper.offsetWidth;
|
||||||
var horizontalSlideCount = horizontalSlides.length;
|
var horizontalSlideCount = horizontalSlides.length;
|
||||||
var horizontalOffset = -(bgWidth - slideWidth)/(horizontalSlideCount-1) * h;
|
var horizontalOffset = -( bgWidth - slideWidth ) / ( horizontalSlideCount-1 ) * h;
|
||||||
|
|
||||||
var slideHeight = parseInt(dom.wrapper.offsetHeight, 10);
|
var slideHeight = dom.wrapper.offsetHeight;
|
||||||
var verticalSlideCount = currentVerticalSlides.length;
|
var verticalSlideCount = currentVerticalSlides.length;
|
||||||
var verticalOffset = verticalSlideCount > 0 ? -(bgHeight - slideHeight)/(verticalSlideCount-1) * v : 0;
|
var verticalOffset = verticalSlideCount > 0 ? -( bgHeight - slideHeight ) / ( verticalSlideCount-1 ) * v : 0;
|
||||||
|
|
||||||
dom.wrapper.style.backgroundPosition = horizontalOffset + 'px ' + verticalOffset + 'px';
|
dom.wrapper.style.backgroundPosition = horizontalOffset + 'px ' + verticalOffset + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// Show fragment, if specified
|
// Show fragment, if specified
|
||||||
if( typeof f !== 'undefined' ) {
|
if( typeof f !== 'undefined' ) {
|
||||||
@@ -1874,12 +1875,12 @@ var Reveal = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the background elements to reflect the current
|
* Updates the background elements to reflect the current
|
||||||
* slide.
|
* slide.
|
||||||
*/
|
*/
|
||||||
function updateBackground() {
|
function updateBackground() {
|
||||||
|
|
||||||
// Update the classes of all backgrounds to match the
|
// Update the classes of all backgrounds to match the
|
||||||
// states of their slides (past/present/future)
|
// states of their slides (past/present/future)
|
||||||
toArray( dom.background.childNodes ).forEach( function( backgroundh, h ) {
|
toArray( dom.background.childNodes ).forEach( function( backgroundh, h ) {
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/*!
|
/*!
|
||||||
* reveal.js 2.6.0-dev (2013-09-15, 14:27)
|
* reveal.js 2.6.0-dev (2013-09-15, 14:47)
|
||||||
* http://lab.hakim.se/reveal-js
|
* http://lab.hakim.se/reveal-js
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
|
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
|
||||||
*/
|
*/
|
||||||
var Reveal=function(){"use strict";function a(a){return b(),Kb||Jb?(window.addEventListener("load",C,!1),l(Qb,a),s(),c(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function b(){Jb="WebkitPerspective"in document.body.style||"MozPerspective"in document.body.style||"msPerspective"in document.body.style||"OPerspective"in document.body.style||"perspective"in document.body.style,Kb="WebkitTransform"in document.body.style||"MozTransform"in document.body.style||"msTransform"in document.body.style||"OTransform"in document.body.style||"transform"in document.body.style,Lb=navigator.userAgent.match(/(iphone|ipod|android)/gi)}function c(){function a(){c.length&&head.js.apply(null,c),d()}for(var b=[],c=[],e=0,f=Qb.dependencies.length;f>e;e++){var g=Qb.dependencies[e];(!g.condition||g.condition())&&(g.async?c.push(g.src):b.push(g.src),"function"==typeof g.callback&&head.ready(g.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],g.callback))}b.length?(head.ready(a),head.js.apply(null,b)):a()}function d(){f(),e(),i(),_(),setTimeout(function(){Vb.slides.classList.remove("no-transition"),Rb=!0,u("ready",{indexh:Fb,indexv:Gb,currentSlide:Ib})},1)}function e(){var a=m(document.querySelectorAll(Nb));a.forEach(function(a){var b=m(a.querySelectorAll("section"));b.forEach(function(a,b){b>0&&a.classList.add("future")})})}function f(){Vb.theme=document.querySelector("#theme"),Vb.wrapper=document.querySelector(".reveal"),Vb.slides=document.querySelector(".reveal .slides"),Vb.slides.classList.add("no-transition"),Vb.background=g(Vb.wrapper,"div","backgrounds",null),Vb.progress=g(Vb.wrapper,"div","progress","<span></span>"),Vb.progressbar=Vb.progress.querySelector("span"),g(Vb.wrapper,"aside","controls",'<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>'),g(Vb.wrapper,"div","state-background",null),g(Vb.wrapper,"div","pause-overlay",null),Vb.controls=document.querySelector(".reveal .controls"),Vb.controlsLeft=m(document.querySelectorAll(".navigate-left")),Vb.controlsRight=m(document.querySelectorAll(".navigate-right")),Vb.controlsUp=m(document.querySelectorAll(".navigate-up")),Vb.controlsDown=m(document.querySelectorAll(".navigate-down")),Vb.controlsPrev=m(document.querySelectorAll(".navigate-prev")),Vb.controlsNext=m(document.querySelectorAll(".navigate-next"))}function g(a,b,c,d){var e=a.querySelector("."+c);return e||(e=document.createElement(b),e.classList.add(c),null!==d&&(e.innerHTML=d),a.appendChild(e)),e}function h(){function a(a,b){var c={background:a.getAttribute("data-background"),backgroundSize:a.getAttribute("data-background-size"),backgroundImage:a.getAttribute("data-background-image"),backgroundColor:a.getAttribute("data-background-color"),backgroundRepeat:a.getAttribute("data-background-repeat"),backgroundPosition:a.getAttribute("data-background-position"),backgroundTransition:a.getAttribute("data-background-transition")},d=document.createElement("div");return d.className="slide-background",c.background&&(/^(http|file|\/\/)/gi.test(c.background)||/\.(png|jpg|jpeg|gif|bmp)$/gi.test(c.background)?d.style.backgroundImage="url("+c.background+")":d.style.background=c.background),c.backgroundSize&&(d.style.backgroundSize=c.backgroundSize),c.backgroundImage&&(d.style.backgroundImage='url("'+c.backgroundImage+'")'),c.backgroundColor&&(d.style.backgroundColor=c.backgroundColor),c.backgroundRepeat&&(d.style.backgroundRepeat=c.backgroundRepeat),c.backgroundPosition&&(d.style.backgroundPosition=c.backgroundPosition),c.backgroundTransition&&d.setAttribute("data-background-transition",c.backgroundTransition),b.appendChild(d),d}r()&&document.body.classList.add("print-pdf"),Vb.background.innerHTML="",Vb.background.classList.add("no-transition"),m(document.querySelectorAll(Nb)).forEach(function(b){var c;c=r()?a(b,b):a(b,Vb.background),m(b.querySelectorAll("section")).forEach(function(b){r()?a(b,b):a(b,c)})});var b=Qb.parallaxBackgroundImage,c=Qb.parallaxBackgroundSize;b&&(Vb.wrapper.style.background=b,Vb.wrapper.style.backgroundSize=c,setTimeout(function(){Vb.wrapper.setAttribute("data-parallax-background",b),Vb.wrapper.setAttribute("data-parallax-background-size",c)},1))}function i(a){if(Vb.wrapper.classList.remove(Qb.transition),"object"==typeof a&&l(Qb,a),Jb===!1&&(Qb.transition="linear"),Vb.wrapper.classList.add(Qb.transition),Vb.wrapper.setAttribute("data-transition-speed",Qb.transitionSpeed),Vb.wrapper.setAttribute("data-background-transition",Qb.backgroundTransition),Vb.controls.style.display=Qb.controls?"block":"none",Vb.progress.style.display=Qb.progress?"block":"none",Qb.rtl?Vb.wrapper.classList.add("rtl"):Vb.wrapper.classList.remove("rtl"),Qb.center?Vb.wrapper.classList.add("center"):Vb.wrapper.classList.remove("center"),Qb.mouseWheel?(document.addEventListener("DOMMouseScroll",tb,!1),document.addEventListener("mousewheel",tb,!1)):(document.removeEventListener("DOMMouseScroll",tb,!1),document.removeEventListener("mousewheel"Line truncated
|
var Reveal=function(){"use strict";function a(a){return b(),Kb||Jb?(window.addEventListener("load",C,!1),l(Qb,a),s(),c(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function b(){Jb="WebkitPerspective"in document.body.style||"MozPerspective"in document.body.style||"msPerspective"in document.body.style||"OPerspective"in document.body.style||"perspective"in document.body.style,Kb="WebkitTransform"in document.body.style||"MozTransform"in document.body.style||"msTransform"in document.body.style||"OTransform"in document.body.style||"transform"in document.body.style,Lb=navigator.userAgent.match(/(iphone|ipod|android)/gi)}function c(){function a(){c.length&&head.js.apply(null,c),d()}for(var b=[],c=[],e=0,f=Qb.dependencies.length;f>e;e++){var g=Qb.dependencies[e];(!g.condition||g.condition())&&(g.async?c.push(g.src):b.push(g.src),"function"==typeof g.callback&&head.ready(g.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],g.callback))}b.length?(head.ready(a),head.js.apply(null,b)):a()}function d(){f(),e(),i(),_(),setTimeout(function(){Vb.slides.classList.remove("no-transition"),Rb=!0,u("ready",{indexh:Fb,indexv:Gb,currentSlide:Ib})},1)}function e(){var a=m(document.querySelectorAll(Nb));a.forEach(function(a){var b=m(a.querySelectorAll("section"));b.forEach(function(a,b){b>0&&a.classList.add("future")})})}function f(){Vb.theme=document.querySelector("#theme"),Vb.wrapper=document.querySelector(".reveal"),Vb.slides=document.querySelector(".reveal .slides"),Vb.slides.classList.add("no-transition"),Vb.background=g(Vb.wrapper,"div","backgrounds",null),Vb.progress=g(Vb.wrapper,"div","progress","<span></span>"),Vb.progressbar=Vb.progress.querySelector("span"),g(Vb.wrapper,"aside","controls",'<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>'),g(Vb.wrapper,"div","state-background",null),g(Vb.wrapper,"div","pause-overlay",null),Vb.controls=document.querySelector(".reveal .controls"),Vb.controlsLeft=m(document.querySelectorAll(".navigate-left")),Vb.controlsRight=m(document.querySelectorAll(".navigate-right")),Vb.controlsUp=m(document.querySelectorAll(".navigate-up")),Vb.controlsDown=m(document.querySelectorAll(".navigate-down")),Vb.controlsPrev=m(document.querySelectorAll(".navigate-prev")),Vb.controlsNext=m(document.querySelectorAll(".navigate-next"))}function g(a,b,c,d){var e=a.querySelector("."+c);return e||(e=document.createElement(b),e.classList.add(c),null!==d&&(e.innerHTML=d),a.appendChild(e)),e}function h(){function a(a,b){var c={background:a.getAttribute("data-background"),backgroundSize:a.getAttribute("data-background-size"),backgroundImage:a.getAttribute("data-background-image"),backgroundColor:a.getAttribute("data-background-color"),backgroundRepeat:a.getAttribute("data-background-repeat"),backgroundPosition:a.getAttribute("data-background-position"),backgroundTransition:a.getAttribute("data-background-transition")},d=document.createElement("div");return d.className="slide-background",c.background&&(/^(http|file|\/\/)/gi.test(c.background)||/\.(png|jpg|jpeg|gif|bmp)$/gi.test(c.background)?d.style.backgroundImage="url("+c.background+")":d.style.background=c.background),c.backgroundSize&&(d.style.backgroundSize=c.backgroundSize),c.backgroundImage&&(d.style.backgroundImage='url("'+c.backgroundImage+'")'),c.backgroundColor&&(d.style.backgroundColor=c.backgroundColor),c.backgroundRepeat&&(d.style.backgroundRepeat=c.backgroundRepeat),c.backgroundPosition&&(d.style.backgroundPosition=c.backgroundPosition),c.backgroundTransition&&d.setAttribute("data-background-transition",c.backgroundTransition),b.appendChild(d),d}r()&&document.body.classList.add("print-pdf"),Vb.background.innerHTML="",Vb.background.classList.add("no-transition"),m(document.querySelectorAll(Nb)).forEach(function(b){var c;c=r()?a(b,b):a(b,Vb.background),m(b.querySelectorAll("section")).forEach(function(b){r()?a(b,b):a(b,c)})});var b=Qb.parallaxBackgroundImage,c=Qb.parallaxBackgroundSize;b&&(Vb.wrapper.style.background=b,Vb.wrapper.style.backgroundSize=c,setTimeout(function(){Vb.wrapper.setAttribute("data-parallax-background",b),Vb.wrapper.setAttribute("data-parallax-background-size",c)},1))}function i(a){if(Vb.wrapper.classList.remove(Qb.transition),"object"==typeof a&&l(Qb,a),Jb===!1&&(Qb.transition="linear"),Vb.wrapper.classList.add(Qb.transition),Vb.wrapper.setAttribute("data-transition-speed",Qb.transitionSpeed),Vb.wrapper.setAttribute("data-background-transition",Qb.backgroundTransition),Vb.controls.style.display=Qb.controls?"block":"none",Vb.progress.style.display=Qb.progress?"block":"none",Qb.rtl?Vb.wrapper.classList.add("rtl"):Vb.wrapper.classList.remove("rtl"),Qb.center?Vb.wrapper.classList.add("center"):Vb.wrapper.classList.remove("center"),Qb.mouseWheel?(document.addEventListener("DOMMouseScroll",tb,!1),document.addEventListener("mousewheel",tb,!1)):(document.removeEventListener("DOMMouseScroll",tb,!1),document.removeEventListener("mousewheel"Line truncated
|
||||||
Reference in new issue
Block a user