Projects

LightEmbed

Wanting to practice my javascript skills and looking for the simplest way to embed a video onto a website, I built LightEmbed which I use here on the site but in a handful of other projects as well.

All you need is the ID of a Vimeo or YouTube video to automatically embed it in a lightbox/modal on your website. LightEmbed detects the video type and displays the video above your content on that page. It’s not perfect, but it works. I’m sure a javascript ninja could massively improve this script.

But, as is, it works in two ways.

Javascript
The first is by calling a javascript function called create_box with the ID passed in the function like “create_box(‘12345678’);”.
YouTube Example / Vimeo Example

GET Variable in URL
The second is by including the ID in a GET variable in the URL named “embed” like greggblanchard.com?embed=12345678.
YouTube Example / Vimeo Example

That’s pretty much it. If you’d like the code, just give me a holler.

--
I like to build stuff in my spare time. These sandbox-like side-projects are a fun way to be creative and test new ideas. Here are the latest.

Hi, I'm Gregg.

I build solutions to marketing problems.

       

By day I run marketing for resort CRM / ecommerce provider, Inntopia. After the kids go to bed my laptop is my workshop as I try turn ideas and challenges into simple tools and solutions.