Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't change background-color of slides, starting with background-fit #624

Open
slambert opened this issue Dec 31, 2016 · 3 comments
Open
Labels

Comments

@slambert
Copy link

slambert commented Dec 31, 2016

Using a background image with background-fit style on a high resolution display.

That means, thanks to the recommendation in #215, this CSS is in the stylesheet:

body > #preso,
body > #preso > .slide {
    height: 100%;
    width: 100%;
} // full width stuff

I'm using an image that doesn't match the aspect ratio of the screen, which creates white space above and below the image. I'd like to make it black. See image below.

background-fit black-1

What I've tried so far:

body > #preso,
body > #preso > .slide {
    height: 100%;
    width: 100%;
    background: #000;
} // full width stuff

I was using this for a while, and it allowed me to change the background colors of slides with <!SLIDE blue> for example. Then creating styles like .blue {background: #0000FF;}. However, the background line in the above css breaks background-fit (I'm embarrassed by how long it took me to track this down).

So I tried this:

body > #preso,
body > #preso > .slide {
    height: 100%;
    width: 100%;
    background-color: #000;
} // full width stuff

This doesn't break background-fit and changes the background black. However, it changes it on every slide. I would like to have a default slide background color that isn't white, but this clearly isn't the best way to do that.

I also haven't been able to find a selector that will change the background of a background-fit slide, nor other slides.

I'm probably missing something obvious because I've been staring at this too long. 😖

@marrero984
Copy link
Contributor

Try assigning a background to just the body. I think #preso and .slide are both exactly the size of that background image and it's just the body that is left. Unfortunately, I don't have it set up to test right now.

body {
  background-color: #000;
}

Those height: 100% don't ever work the way I expect them to. I think a both of the elements have to be changed to explicit blocks

@slambert
Copy link
Author

slambert commented Jan 1, 2017

@marrero984 I believe that would change the background on every slide. I'm trying to use different backgrounds on certain slides using .background-fit or .blue (as two examples).

Open to suggestions!

@binford2k
Copy link
Owner

@slambert unfortunately at this point div#preso doesn't fill the screen, so the body will show around it. A gross hack could be to assign the body background-color dynamically each time a slide is changed.

Something like the following completely untested js could work. Just drop it in a *.js file in the presentation root.

$('.content.blue').bind('showoff:show', function (event) {
    $('body').css('background-color', 'blue'),
});
$('.content.blue').bind('showoff:next', function (event) {
    $('body').css('background-color', 'black'),
});

@marrero984 is working on revamping the structure of the slides completely, and this issue should go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants