Skip to content

Instantly share code, notes, and snippets.

@jamiehs
Created October 4, 2012 14:52
Show Gist options
  • Save jamiehs/3834044 to your computer and use it in GitHub Desktop.
Save jamiehs/3834044 to your computer and use it in GitHub Desktop.
Addition to a SlideDeck 2 lens.js file for adding an external title (Tool kit)
// This should be added to your custom lens based on the Tool Kit lens, right after these functions near the end of the file:
deckNavigation();
overlay();
setOptions();
deckAdjustments();
bindScrollEventForDotUpdate();
bindScrollEventForThumbUpdate();
// Add the external title to the frame
var titleElement = $('<div class="sd2-external-title"></div>').appendTo( elems.frame );
// These CSS adjustments are not necessary, but for brevity they are included.
// You can remove this CSS block and instead style: .lens-my-custom-lens-name .sd2-external-title { property: value; }
titleElement.css({
'position': 'absolute',
'top': 30,
'left': 30,
'z-index': 20,
'font-size': 20
});
// Add the current slide's title to the external title
titleElement.text( elems.slides.filter(':eq(' + ( deck.options.start - 1 ) + ')').find('.sd2-slide-title').text() );
// Add a before callback, running any existing callbacks first...
deck.options.before = function( deck ){
if(typeof(oldBefore) == 'function') oldBefore(deck);
// Update the external title with the current slide's content:
titleElement.text( elems.slides.filter(':eq(' + ( deck.current - 1 ) + ')').find('.sd2-slide-title').text() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment