Twine 2, Sugarcube 2.
Heya, I've been trying to implement the custom Fullscreen Macro by Chapel but there seems to be a problem when using <<fullscreenlink 'FullScreen Mode'>> The code works, and it functions properly, though it doesn't seem to like my backgrounds. It won't fit to scale with the image (gif) I've selected. Here's the CSS for the image:
/* for Snowy background */
body.startbg {
min-height: 100%;
background-image: url('https://data.whicdn.com/images/301701280/original.gif');
background-size: 100% 100%;
background-repeat: no-repeat;
background-attachment: fixed;
And it appears as so:
https://puu.sh/zo09m/05407051dd.png
The JS for this is below:
// fullscreen function
setup.fullscreen = function (element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
Macro.add('fullscreen', {
handler : function() {
var bg = $('body').css('background-color');
$('html').css('background-color', bg);
setup.fullscreen(document.documentElement);
}
});
Macro.add('fullscreenlink', {
handler : function() {
var $wrapper = $(document.createElement('span'));
var $link = $(document.createElement('a'));
var className = 'macro-' + this.name;
var bg;
var linkText;
if (this.args.length !== 1) {
return this.error('incorrect number of arguments');
}
linkText = this.args[0];
$link
.wiki(linkText)
.attr('id', 'fullscreen-macro-link')
.ariaClick( function () {
bg = $('body').css('background-color');
$('html').css('background-color', bg);
setup.fullscreen(document.documentElement);
});
$wrapper
.append($link)
.addClass(className)
.appendTo(this.output);
}
});