Skip to content

Instantly share code, notes, and snippets.

View jobayerarman's full-sized avatar
🤡
Procrastinating

Jobayer Arman jobayerarman

🤡
Procrastinating
View GitHub Profile
/* Parallax Scrolling */
$(function parallaxScrolling() {
$window = $(window); // Cache the Window object
var width = $window.width(); // Cache the window width
var $bgobj = $('.parallax'); // assigning the object
$('.parallax').each(function(){
var $bgobj = $(this); // assigning the object
$(window).scroll(function() {
<script type="text/javascript">
var ypos, image;
function parallax () {
ypos = window.pageYOffset;
image = document.getElementById('');
image.style.top = ypos * 0.4 + 'px';
}
window.addEventListener('scroll', parallax);
</script>