Skip to content

Instantly share code, notes, and snippets.

@yratof
Created February 20, 2015 14:23
Show Gist options
  • Save yratof/40708b8f351842bd5662 to your computer and use it in GitHub Desktop.
Save yratof/40708b8f351842bd5662 to your computer and use it in GitHub Desktop.
Animate fade in elements on first / last grid
<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