Hey folks! I searched the forum for backgrounds but couldn't locate anything to shed light on my particular problem:
I want to assign a different background picture to various passages, ie locations, etc. I can do one background image just fine, and I tried adjusting the script for different colors to display images, but I keep getting an illegal error when I try to preview the story.
I tried this code in the stylesheet:
html.image1 {
background: url("http://imgur.com/image1.jpg") no-repeat center center fixed;
background-size: cover;
}
html.image2 {
background: url("http://imgur.com/image2.jpg") no-repeat center center fixed;
background-size: cover;
}
html.image3 {
background: url("http://imgur.com/image3.jpg") no-repeat center center fixed;
background-size: cover;
}
And this is what I tried in the passages:
{
(print: "<script>$('html').removeClass(\)</script>")
(if: (image1:)'s tags's length > 0)[
(print: "<script>$('html').addClass('" + (image1:)'s tags.join(' ') + "'\)</script>")
]
}
I'm at a loss at this point of what I'm doing wrong, so any help will be appreciated. I'm using Twine 2 and Sugarcube 2.7.2.
I want to assign a different background picture to various passages, ie locations, etc. I can do one background image just fine, and I tried adjusting the script for different colors to display images, but I keep getting an illegal error when I try to preview the story.
I tried this code in the stylesheet:
html.image1 {
background: url("http://imgur.com/image1.jpg") no-repeat center center fixed;
background-size: cover;
}
html.image2 {
background: url("http://imgur.com/image2.jpg") no-repeat center center fixed;
background-size: cover;
}
html.image3 {
background: url("http://imgur.com/image3.jpg") no-repeat center center fixed;
background-size: cover;
}
And this is what I tried in the passages:
{
(print: "<script>$('html').removeClass(\)</script>")
(if: (image1:)'s tags's length > 0)[
(print: "<script>$('html').addClass('" + (image1:)'s tags.join(' ') + "'\)</script>")
]
}
I'm at a loss at this point of what I'm doing wrong, so any help will be appreciated. I'm using Twine 2 and Sugarcube 2.7.2.