Git Product home page Git Product logo

Comments (9)

ijlyttle avatar ijlyttle commented on June 4, 2024 2

FWIW, this seems to work too (including the css from above):

```{r, echo = FALSE}
library("vembedr")
library("htmltools")

embed_youtube("DQiKHlpy70Q") %>% div(class = "vembedr")
```

from vembedr.

ijlyttle avatar ijlyttle commented on June 4, 2024 1

Reconsidering, given that I am looking to create a function called div_bs_responsive().

This could be a function something like:

div_rounded <- function(..., radius = 50)

we could use htmltools::htmlDependencies() to make sure the CSS comes along for the ride...

from vembedr.

ijlyttle avatar ijlyttle commented on June 4, 2024

Although interesting, I think this is outside the scope of what (as least I think) the package does.

For me, the mission of this package begins and ends at the <iframe/>.

I am interested (outside of this package) to see how rounded corners could be implemented - from my poking around, I see there is some difficulty in Chrome.

from vembedr.

ginolhac avatar ginolhac commented on June 4, 2024

Hi,

no worries, I get your point of view.
Actually, you don't need to change anything, @koncina found a css solution that works well. Your package is used within his tweaked version of ioslides, called iosp

this code:

## Art | by Marcus Volz

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">A compilation of some of my gifs created with <a href="https://twitter.com/hashtag/rstats?src=hash">#rstats</a> <a href="https://twitter.com/hashtag/ggplot2?src=hash">#ggplot2</a> <a href="https://twitter.com/hashtag/gganimate?src=hash">#gganimate</a> <a href="https://twitter.com/hashtag/tweenr?src=hash">#tweenr</a> <a href="https://t.co/nCppSOZv4W">https://t.co/nCppSOZv4W</a></p>&mdash; Marcus Volz (@mgvolz) <a href="https://twitter.com/mgvolz/status/849375922297991168">4 avril 2017</a></blockquote>

```{css}
.vembedr {
  border-radius: 50px;
  overflow: hidden;
  border: 2px solid black;
}

.vembedr iframe {
  margin: -5px;
  width: calc(100% + 10px);
}
```

<div class = "vembedr">
```{r, echo = FALSE}
vembedr::embed_youtube("DQiKHlpy70Q")
```
</div>

gives:
image

Of note, it works with both Chrome and Firefox on mac and GNU/Linux

from vembedr.

ijlyttle avatar ijlyttle commented on June 4, 2024

That looks excellent!

In that case, with @konica's permission, maybe the thing to do is to put this into a vignette.

Reopening!

from vembedr.

koncina avatar koncina commented on June 4, 2024

I'm fine with that.
The code can even be simplified by displaying the iframe as a block (I also removed the border for the container as it is optional):

```{css}
.vembedr {
  border-radius: 50px; /* adjust it to your needs */
  overflow: hidden;
}

.vembedr iframe {
  display: block;
  border: none;
}
```

<div class = "vembedr">
```{r, echo = FALSE}
vembedr::embed_youtube("DQiKHlpy70Q")
```
</div>

from vembedr.

ginolhac avatar ginolhac commented on June 4, 2024

thanks Eric! And sorry for the user konica (~ koncina) who received an unintended message from Ian ;)

from vembedr.

ijlyttle avatar ijlyttle commented on June 4, 2024

Thanks Eric, and sorry to you both! I will get on this!

from vembedr.

ijlyttle avatar ijlyttle commented on June 4, 2024

Just added this stuff to README, thanks!

from vembedr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.