Reputation: 23
I am using Bootstrap 3.1 on a website for a client who wants parallax scrolling, but I have an issue with the coding behind the parallax scrolling, because I simply can't figure out why my coding works.
I have a piece of code used for parallax scrolling, and it works, and I simply cannot figure out why. The piece of code is as follows, but I do not have any jQuery rules that applies to the data-type or the data-speed.
<div class="bg-parallax" id="par-studying" data-type="background" data-speed="20">
</div><!--End of parallax-background-->
My CSS code for those rules is
.bg-parallax {
background: no-repeat fixed;
background-position: 50% 50%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 300px;
margin: 0 auto;
width: 100%;
}
I suspect that it is because of the fixed background, but I am not sure.
Upvotes: 1
Views: 12721
Reputation: 43698
You must be using some JavaScript code somewhere to do parallax, because that CSS alone won't do it.
Based on the data-
attributes, I'm guessing that this is what you are using: A Simple Parallax Scrolling Technique
That site explains the code.
Upvotes: 2