fahmidur / xkcd-embedder

Embed the latest XKCD, a particular XKCD, or a random XKCD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XKCD Embedder

A small bit of JS for embedding XKCDs. Embed the latest XKCD, a particular XKCD, or a random XKCD.

For sample usage see xkcd-embedder.fahmidur.com

Setup

In your header add the stylesheet:

<link rel='stylesheet' href='http://xkcd-embedder.fahmidur.com/css/xkcd-embedder.css'/>

At the end of your body place:

<script src='http://xkcd-embedder.fahmidur.com/js/xkcd-embedder.js'></script>

Usage

For the latest XKCD:

<div class='xkcd-embed' data-id='latest'></div>

For an XKCD with a particular ID:

<div class='xkcd-embed' data-id='1'></div>

For a random XKCD:

<div class='xkcd-embed' data-id='random'></div>

You can also set the maxWidth if you need it.

<div class='xkcd-embed' data-id='random' data-maxWidth='400px'></div>

Dependencies

None. This widget was designed to be embedded into someone else's webpage and it wouldn't be nice to impose any dependencies on the host page.

Screenshot when embedded

(Screenshot when logged in

About

Embed the latest XKCD, a particular XKCD, or a random XKCD


Languages

Language:JavaScript 82.7%Language:CSS 6.6%Language:Ruby 5.4%Language:HTML 4.4%Language:Shell 0.6%Language:EJS 0.2%