1

I am creating a page with some parallex bg effect.. i have three divs with same background see this fiddle

when i use different bg images for all the divs then the parallex is working but with same bg images to all the divs, its not working.

I am using this parallax jQuery plugin http://ianlunn.co.uk/plugins/jquery-parallax/

Jquery code

$(document).ready(function(){
  $('.sep').parallax("50%", 0.6);
});

2 Answers 2

2

It seems you need to call parallax on each element individually. You can do so with each:

$('.sep').each(function(){
   $(this).parallax("50%", 0.6); 
});

http://jsfiddle.net/PmYsC/1/

Sign up to request clarification or add additional context in comments.

Comments

1

Add a unique class onto each one.

$(document).ready(function(){
  $('.sep1').parallax("50%", 0.6);
  $('.sep2').parallax("50%", 0.6);
  $('.sep3').parallax("50%", 0.6);
});

http://jsfiddle.net/wEpMM/

1 Comment

Yes. But actually the problem is i am using it in single page wordpress theme and after each section of pages this div with class sep added so then i have to dynamically add numbers to each class with php, but just wanted a workaround with js only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.