Vikas Ghodke
Vikas Ghodke

Reputation: 6655

JQuery Parallax not working

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);
});

Upvotes: 1

Views: 6636

Answers (2)

James Montagne
James Montagne

Reputation: 78630

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/

Upvotes: 2

Rob Schmuecker
Rob Schmuecker

Reputation: 8954

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/

Upvotes: 1

Related Questions