Embedding Responsively

website
embed

(Victoriabarker) #1

Hi - I'm using the standard iFrame snippet to embed my models on my pages.

It works well enough but has anyone access to a snippet that will allow something more responsive ie: Desktop / Tablet and Handset?

Thanks


(Shaderbytes) #2

Well without knowing exactly how your website is built no one can answer that exactly. You can add width and height of 100% to the sketchfab iframe and it will be fully responsive to the containing div. How that containing div is sized is dependent on the website of coarse, using your regular css media queries for desktop / tablet / mobile layouts.


(Victoriabarker) #3

ah - of course, thats excellent - Thank you


#4

Here's a Gist to make responsive iframes with a constant aspect ratio:


(Shaderbytes) #5

Excellent James , handles the height elegantly while the parent will still control width :wink: