Created
February 20, 2015 14:23
-
-
Save yratof/40708b8f351842bd5662 to your computer and use it in GitHub Desktop.
Animate fade in elements on first / last grid
This file contains hidden or 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
<style> | |
/* This, if .js is active, will hide the content for the next script*/ | |
.js .first, .js .last { opacity: 0; } | |
.js .first { left: -10vw; } | |
.js .last { right: -10vw; } | |
</style> | |
<script type="text/javascript"> | |
(function (jQuery) { | |
jQuery(window) | |
.load(function () { | |
var RightSide = jQuery(".last"); | |
var LeftSide = jQuery(".first"); | |
setTimeout(function () { | |
RightSide.animate({ | |
opacity: 1 | |
}, { | |
queue: false, | |
duration: 700 | |
}); | |
RightSide.animate({ | |
"right": "0", | |
marginRight: 0 | |
}, { | |
queue: false, | |
duration: 700 | |
}); | |
LeftSide.animate({ | |
opacity: 1 | |
}, { | |
queue: false, | |
duration: 700 | |
}); | |
LeftSide.animate({ | |
"left": "0" | |
}, { | |
queue: false, | |
duration: 700 | |
}); | |
}, 350); | |
}); | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment