Created
February 18, 2012 09:08
-
-
Save imakewebthings/1858370 to your computer and use it in GitHub Desktop.
Because sometimes things need to die.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* How one might go about removing (and restoring) deck.js from a page */ | |
$(function() { | |
/* Give all the link tags pointing to deck related CSS files a class (.deck-css here) */ | |
var $deckStyles = $('.deck-css'); | |
/* Store their hrefs for later */ | |
$deckStyles.each(function() { | |
$(this).data('href', this.href); | |
}); | |
function deckOff() { | |
/* Kill styles */ | |
$deckStyles.each(function() { | |
this.href = ''; | |
}); | |
/* Kill all the native events that were bound. All extensions in | |
the deck.js repo are properly scoped like this. I can't speak | |
to any of the 3rd-party extensions. */ | |
$(document).add('*').unbind('.deck .decknavigation .deckgoto .deckmenu .deckstatus .deckhash .deckscale'); | |
} | |
function deckOn() { | |
/* Restore styles */ | |
$deckStyles.each(function() { | |
this.href = $(this).data('href'); | |
}); | |
/* Reinitialize deck events */ | |
$.deck('.slide'); | |
} | |
/* Normal init call, nothing new here */ | |
$.deck('.slide'); | |
$('.this-element-turns-deck-off').click(function(e) { | |
deckOff(); | |
e.preventDefault(); | |
}); | |
$('.this-element-turns-deck-on').click(function(e) { | |
deckOn(); | |
e.preventDefault(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment