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

Change position of logo in revealjs slides #809

Closed
rleyvasal opened this issue May 5, 2022 · 5 comments
Closed

Change position of logo in revealjs slides #809

rleyvasal opened this issue May 5, 2022 · 5 comments

Comments

@rleyvasal
Copy link

Can the logo be changed to a different part of the slides?

It would be great for users to have the ability to change the position of the logo in the slides. For example, I would like to have the logo on top left instead of bottom right (it interferes with controls if used in bottom right)

Quarto documentation shows how to add logo with the following code, but changing position is not mentioned:

---
format:
  revealjs:
    logo: logo.png
    footer: "Footer text"
---
@rleyvasal rleyvasal changed the title Change position of logo in slides Change position of logo in revealjs slides May 5, 2022
@jjallaire
Copy link
Collaborator

There isn't currently a feature for this, but you can accomplish it by adding the following CSS block to your presentation:

```{=html}
<style type="text/css">
.reveal .slide-logo {
  top: 0;
  left: 12px
}
</style>
```

@rleyvasal
Copy link
Author

Thanks @jjallaire! - this is exactly what I was looking for.

@rleyvasal
Copy link
Author

Where should the code chunk be added so it does not affect the TOC on the Menu?

I added the code chunk just below the yaml header and I noticed it creates new slides on TOC.

extra entry on toc

@rleyvasal rleyvasal reopened this May 6, 2022
@jjallaire
Copy link
Collaborator

You could just include that same CSS in a styles.css file and then reference it with css: styles.css

@giabaio
Copy link
Contributor

giabaio commented Jul 14, 2022

Would something like this (which I'm trying to hack from xaringan) work?
(save this to a include-logo.html file and add that as include-after-body in the yaml)

<style>
.logo {
  background-image: url("FILE.png");
  background-size: 14% 7%;
  background-repeat: no-repeat;
  position: absolute;
  top:  1.7%;
  left: 86%;
  height: 100%;
  width: 100%;
  z-index: 1000; !default
}
</style>

<script>
document
  .querySelectorAll(
    '.slides' +
    'div.title-slide:not(.center)'
  )
  .forEach(el => {
    el.innerHTML += '<div class="logo"></div>';
  });
</script>

I have to say that this does work and puts a file on every slide in the position I specify (and with the features I specify). The only thing I've not cracked yet is that, mainly because I don't really know what I'm doing (...), I can't exclude specific types of slides. For example, I have a title-slide class, which I have managed to make work and draw info from the yaml to produce a specific template/format for the first page of the presentation. I would also like to not include the logo on that slide (but the above doesn't work)...

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

No branches or pull requests

3 participants