update code style to match rest of reveal.js, disable parallax by default #595
This commit is contained in:
parent
2fc0dfa8e1
commit
347a907041
@ -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;
|
||||||
|
@ -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: [
|
||||||
|
29
js/reveal.js
29
js/reveal.js
@ -480,7 +480,7 @@ var Reveal = (function(){
|
|||||||
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;
|
||||||
|
|
||||||
@ -489,8 +489,8 @@ var Reveal = (function(){
|
|||||||
// 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 );
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1497,25 +1497,26 @@ var Reveal = (function(){
|
|||||||
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);
|
else {
|
||||||
bgHeight = parseInt(bs[1], 10);
|
bgWidth = parseInt( bs[0], 10 );
|
||||||
|
bgHeight = parseInt( bs[1], 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var slideWidth = parseInt(dom.wrapper.offsetWidth, 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';
|
||||||
}
|
}
|
||||||
|
4
js/reveal.min.js
vendored
4
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user