Skip to content

Instantly share code, notes, and snippets.

@imakewebthings
imakewebthings / modernizr-bgc-text.js
Created April 5, 2011 07:44
backgroundClip: text; revision for FF4?
Modernizr.addTest('backgroundcliptext',function(){
var div = document.createElement('div');
var bgClip = false;
if ('backgroundClip' in div.style) bgClip = true;
'Webkit Moz O ms Khtml'.replace(/([A-Za-z]*)/g, function(val) {
if (val+'BackgroundClip' in div.style) bgClip = true;
});
if (bgClip) {
div.style.backgroundClip = 'text';
if (div.style.backgroundClip === 'text') return true;
@imakewebthings
imakewebthings / gist:1113084
Created July 29, 2011 03:44
TNF- Assets with copy
REMOVED /account/btnCheckOrderStatus.png
REMOVED /account/btnCreateAccount.png
REMOVED /account/btnCreateAccountR.png
REMOVED /account/btnEditPrefs.png
REMOVED /account/btnSavePrefs.png
REMOVED /account/btnSignInR.png
REMOVED /account/btnUnsubscribe.png
REMOVED /checkout/btnApply.png
REMOVED /checkout/btnApplyBalance.png
REMOVED /checkout/btnBackToOffer.png
@imakewebthings
imakewebthings / gist:1216527
Created September 14, 2011 13:20
Extended Slide Events
(function($, deck, undefined) {
$(document).bind('deck.change', function(e, from, to) {
var $prev = $[deck]('getSlide', to-1),
$next = $[deck]('getSlide', to+1);
$[deck]('getSlide', to).trigger('deck.becameCurrent');
$prev && $prev.trigger('deck.becamePrevious');
$next && $next.trigger('deck.becameNext');
});
})(jQuery, 'deck');
$(document).bind('deck.change', function(e, from, to) {
var osp = $.deck('getOptions').classes.onPrefix;
$.deck('getContainer')
.removeClass(osp + $.deck('getSlide', from).attr('id'))
.addClass(osp + $.deck('getSlide', to).attr('id'));
});
$(document).ready(function() {
$.waypoints.settings.scrollThrottle = 30;
$('#main').waypoint(function(event, direction){
/* Just as we have a sticky class applied when we hit the top waypoint,
we'll have a different class applied when we bottom out */
if (direction === 'down') {
$(this).removeClass('sticky').addClass('bottomed');
}
else {
$(this).removeClass('bottomed').addClass('sticky');
@imakewebthings
imakewebthings / gist:1342565
Created November 6, 2011 06:52
deck.horizon first crack
<script>
(function($, deck, undefined) {
var $d = $(document),
toggleHorizon = function(base, fn) {
var slides = $[deck]('getSlides'),
opts = $[deck]('getOptions'),
min = base - opts.horizon,
max = base + opts.horizon,
i;
@imakewebthings
imakewebthings / deck.destroy.js
Created February 18, 2012 09:08
Because sometimes things need to die.
/* 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);
});
@imakewebthings
imakewebthings / deck.audio.js
Created February 21, 2012 03:39
Background audio for each slide in deck.js
/* Plays all audio elements inside a slide when the slide becomes active
and pauses them when the user navigates away. Replace pause with
whatever functionality desired (maybe pause and set currentTime to 0?) */
$(document).bind('deck.change', function(e, from, to) {
$.deck('getSlide', from).find('audio').each(function() {
this.pause && this.pause();
});
$.deck('getSlide', to).find('audio').each(function() {
this.play && this.play();
});
<div class="slide">
<pre><code>var x = 5;
x * x; => <span class="reveal"><span class="first">???...</span><span class="second">25</span></span></code></pre>
</div>
<style>
.reveal {
-webkit-transform:none !important;
-moz-transform:none !important;
-o-transform:none !important;
$(document).bind('deck.change', function(event, from, to) {
var $entering = $.deck('getSlide', to);
$leaving = $.deck('getSlide', from);
if ($entering.hasClass('animation')) {
// Do what you need to do to start animation inside currentSlide
}
if ($leaving.hasClass('animation')) {
// Do what you need to do to stop animation, if anything