Skip to content

Instantly share code, notes, and snippets.

@simplesthing
Last active August 29, 2015 14:18
Show Gist options
  • Save simplesthing/69077100b6c257b59991 to your computer and use it in GitHub Desktop.
Save simplesthing/69077100b6c257b59991 to your computer and use it in GitHub Desktop.
wrap in a directional floated parent JS
var rightSlideContainer, leftSlideContainer, rightSlideContent, leftSLideContent, journeyContainer, selectedChallenge;
// create right and left slider wrappers
rightSlideContainer = document.createElement('div');
rightSlideContainer.setAttribute('style', 'float: right; height:100%;');
leftSlideContainer = document.createElement('div');
leftSlideContainer.setAttribute('style', 'float: left; height: 100%;');
// get content to wrap
rightSlideContent = document.querySelectorAll('.right');
leftSLideContent = document.querySelectorAll('.left');
// wrap content
_.map(document.querySelectorAll('.right'), function(element) {
rightSlideContainer.appendChild(element);
});
_.map(document.querySelectorAll('.left'), function(element) {
leftSlideContainer.appendChild(element);
});
// Insert content back into journey
journeyContainer = document.querySelector('.journey');
selectedChallenge = journeyContainer.querySelector('.challenge');
journeyContainer.appendChild(leftSlideContainer);
journeyContainer.appendChild(selectedChallenge);
journeyContainer.appendChild(rightSlideContainer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment