I'm at a loss as to how I could optimize this bit of code. I realize I could place these objects into some sort of array, but I'm not sure how to go about this.
$(document).ready(function () {
var $stripe01 = $('.stripe-01');
var $stripe02 = $('.stripe-02');
var $stripe03 = $('.stripe-03');
var $stripe04 = $('.stripe-04');
var $stripe05 = $('.stripe-05');
var $stripe06 = $('.stripe-06');
$(window).scroll(function () {
var s = $(this).scrollTop(),
d = $(document).height(),
c = $(this).height();
scrollPercent = (s / (d - c) * 18);
scrollPercent02 = (s / (d - c) * 14);
scrollPercent03 = (s / (d - c) * 30);
scrollPercent04 = (s / (d - c) * 4);
var position01 = -(scrollPercent * ($(document).width() - $stripe01.width()));
var position02 = -(scrollPercent02 * ($(document).width() - $stripe01.width()));
var position03 = -(scrollPercent03 * -($(document).width() - $stripe03.width()));
var position04 = (scrollPercent04 * -($(document).width() - $stripe04.width()));
$stripe01.css({
'left': position01
});
$stripe02.css({
'left': position02
});
$stripe03.css({
'right': position03
});
$stripe04.css({
'right': position03
});
$stripe05.css({
'right': position03
});
$stripe06.css({
'left': position04
});
});
});