Skip to content

Instantly share code, notes, and snippets.

@postmodern
Created August 12, 2011 04:55
Show Gist options
  • Save postmodern/1141488 to your computer and use it in GitHub Desktop.
Save postmodern/1141488 to your computer and use it in GitHub Desktop.
Convert Markdown slides (separated by ------------- dividers) into divs for slippy.js
$(function() {
var $slides = $("#slides");
var $currentSlide = null;
function newSlide() {
$currentSlide = $('<div class="slide"></div>')
$currentSlide.appendTo($slides);
}
newSlide();
$("#content > *").remove().each(function() {
if ($(this).is('hr')) {
newSlide();
}
else
{
$currentSlide.append(this);
}
});
$("#slides > .slide").slippy({
// settings go here
// possible values are:
// - animLen, duration for default animations (0 = disabled)
// - animInForward, receives a slide and animates it
// - animInRewind, receives a slide and animates it
// - animOutForward, receives a slide and animates it
// - animOutRewind, receives a slide and animates it
// - baseWidth, defines the base for img resizing, if you don't want only
// full-width images, specify this as the pixel width of a slide so that
// images are scaled properly (default is 620px wide)
// - ratio, defines the width/height ratio of the slides, defaults to 1.3 (620x476)
// - margin, the fraction of screen to use as slide margin, defaults to 0.15
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment