Add Parallax using Jquery

$(window).scroll(function() {
  var scrollTop = $(this).scrollTop();
  $(".parallax").each(function(){
    var topGap = $(this).offset().top / 2;;
    var a = topGap; //predefine val
    var b = scrollTop; //each scroll val
    var c = parseInt(b * 0.50, 10); //diff. on each scroll
    var result = a - c;
    $(this).css("background-position", "center "+ result +"px");
  });
});

Comments

Popular posts from this blog

Pagination of multiple recent post blog

Service Filter

When You Want to open popup(first time load)