From 3ac0b8c8f70a0b6e627c7105f8efc366bd6697b9 Mon Sep 17 00:00:00 2001 From: Nate Delage Date: Fri, 7 Nov 2014 21:53:12 -0600 Subject: [PATCH] Support HTML string as argument to TRANSITION fn --- js/transitions.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/js/transitions.js b/js/transitions.js index e79ba47..a71c020 100644 --- a/js/transitions.js +++ b/js/transitions.js @@ -105,9 +105,26 @@ } }; - // `contents` must include an element with the class 'content' and can - // optionally include a number of Ratchet bar elements (see `barSelectors`) + // `contents` can either be a string of HTML or a DOM object. + // Either way, `contents` must include: + // * bar elements (optional -- see `barSelectors`) + // * a single content element + // All as children of a single parent. + // + // For example: + //
+ //
+ //
+ //
+ //
var TRANSITION = function (contents, transition, complete) { + + if(typeof(contents) === 'string' || contents instanceof String) { + var div = document.createElement('div'); + div.innerHTML = contents; + contents = div.childNodes[0]; + } + if (transition) { updateBars(contents);