Instantly share code, notes, and snippets.

Embed
What would you like to do?
Startup Design Framework - How to implement Parallax
// Parallax - paste this code in script.js
$('.content-23.custom-bg').each(function() {
if(! isMobile.any())
$(this).parallax('50%', 0.3, true);
else
$(this).css('background-attachment', 'initial');
});
/* paste this code in style.css */
.content-23.custom-bg {
background-image: url('../../path/to/image.jpg');
background-position: 50% 50%;
background-repeat: no-repeat;
background-attachment: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
<!-- Place in this order at the end of the document so the pages load faster -->
<script src="../../common-files/js/jquery.parallax.min.js"></script>
<script src="../../js/script.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment