aboutsummaryrefslogtreecommitdiff
path: root/js/reveal.js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim@squarespace.com>2013-06-04 19:58:50 +0200
committerHakim El Hattab <hakim@squarespace.com>2013-06-04 19:58:50 +0200
commitc11e8f624f34729363cc35d5a083476c356e824a (patch)
tree82d1083d592072972d1dfacce33de32d9f6a5c9e /js/reveal.js
parentbfadfcc7ce8235ad90982aa5020731db9b2ee69c (diff)
downloadperl-software-in-gnu-guix-c11e8f624f34729363cc35d5a083476c356e824a.tar
perl-software-in-gnu-guix-c11e8f624f34729363cc35d5a083476c356e824a.tar.gz
support for optional background property overrides (#453)
Diffstat (limited to 'js/reveal.js')
-rw-r--r--js/reveal.js21
1 files changed, 16 insertions, 5 deletions
diff --git a/js/reveal.js b/js/reveal.js
index edad911..6e5f9e4 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -258,19 +258,30 @@ var Reveal = (function(){
// given slide
function _createBackground( slide, container ) {
- var background = slide.getAttribute( 'data-background' );
+ var data = {
+ background: slide.getAttribute( 'data-background' ),
+ backgroundSize: slide.getAttribute( 'data-background-size' ),
+ backgroundRepeat: slide.getAttribute( 'data-background-repeat' ),
+ backgroundPosition: slide.getAttribute( 'data-background-position' )
+ };
+
var element = document.createElement( 'div' );
- if( background ) {
+ if( data.background ) {
// Auto-wrap image urls in url(...)
- if( /\.(png|jpg|jpeg|gif|bmp|)$/gi.test( background ) ) {
- element.style.backgroundImage = 'url('+ background +')';
+ if( /\.(png|jpg|jpeg|gif|bmp|)$/gi.test( data.background ) ) {
+ element.style.backgroundImage = 'url('+ data.background +')';
}
else {
- element.style.background = background;
+ element.style.background = data.background;
}
}
+ // Additional and optional background properties
+ if( data.backgroundSize ) element.style.backgroundSize = data.backgroundSize;
+ if( data.backgroundRepeat ) element.style.backgroundRepeat = data.backgroundRepeat;
+ if( data.backgroundPosition ) element.style.backgroundPosition = data.backgroundPosition;
+
container.appendChild( element );
return element;