Skip to content

Instantly share code, notes, and snippets.

@zvodd
Last active August 29, 2015 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zvodd/035e488f912aa18ba0c6 to your computer and use it in GitHub Desktop.
Save zvodd/035e488f912aa18ba0c6 to your computer and use it in GitHub Desktop.
UserScript | xkcd.com | Show xkcd comic captions on the page. (Click the comic image to make it stay.)
// ==UserScript==
// @name xkcd captionator
// @namespace https://gist.github.com/zvodd/035e488f912aa18ba0c6
// @version 0.1
// @description Show xkcd comic captions on the page. (Click the comic image to make it stay.)
// @match http://xkcd.com/*
// @copyright 2014+, zvodd
// ==/UserScript==
var comic = $("#comic>img"),
caption = $("<p>"+comic.attr("title")+"</p>").insertAfter(comic);
comic.removeAttr("title");
caption.hide();
comic.hover(function () {
caption.clearQueue().slideDown();
});
comic.mouseleave(function () {
caption.clearQueue().delay(1200).slideUp();
});
comic.click(function () {
comic.unbind('mouseleave');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment