Skip to content

Instantly share code, notes, and snippets.

@Zillionx
Last active September 29, 2018 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zillionx/70256354b254cf263907 to your computer and use it in GitHub Desktop.
Save Zillionx/70256354b254cf263907 to your computer and use it in GitHub Desktop.
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