Last active
August 29, 2015 14:18
-
-
Save simplesthing/69077100b6c257b59991 to your computer and use it in GitHub Desktop.
wrap in a directional floated parent JS
This file contains 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
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