浏览代码

Allow multiple data-background

Christian Meeßen 4 年之前
父节点
当前提交
8347a2de58
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      js/controllers/slidecontent.js

+ 7 - 1
js/controllers/slidecontent.js

@@ -102,7 +102,13 @@ export default class SlideContent {
 
 				// Images
 				if( backgroundImage ) {
-					backgroundContent.style.backgroundImage = 'url('+ encodeURI( backgroundImage ) +')';
+					let backgroundString = ''
+					backgroundImage.split(',').forEach(background => {
+						backgroundString = backgroundString.concat(
+							'url(' + encodeURI(background.trim()) + '),'
+						);
+					})
+					backgroundContent.style.backgroundImage = backgroundString.substr(0, backgroundString.length - 1);
 				}
 				// Videos
 				else if ( backgroundVideo && !this.Reveal.isSpeakerNotes() ) {