;((function(){
Element.implement({
parallax: function(){
var height, self = this,
firstTop = this.getPosition().y,
pos, top;
var update = function(){
pos = window.getScroll().y;
top = self.getPosition().y;
height = self.getSize().y;
speedFactor = self.get('data-parallax-delta') || 0.7;
if (top + height < pos || top > pos + window.getSize().y) {
return;
}
self.style.backgroundPosition = "0 " + -(Math.round((firstTop - pos) * speedFactor)) + "px";
}
RokScrollEvents.push(update);
update();
}
});
window.addEvent('load', function(){
document.getElements('.rt-parallax').each(function(element){
element.parallax();
});
});
})());
speedFactor = self.get('data-parallax-delta') || 0.7;
speedFactor = -0.5;
document.getElements('.rt-parallax').each(function(element){
document.getElements('.[YOUR_CSS_BODY_CLASS]').each(function(element){
var RokScrollEvents = [], RTScroll = function(){
if (!RokScrollEvents.length) window.removeEvent('scroll', RTScroll);
else {
for (var i = RokScrollEvents.length - 1; i >= 0; i--){
RokScrollEvents[i]();
};
}
};
window.addEvent('load', function(){
window.addEvent('scroll', RTScroll);
RTScroll();
});
.YOUR_CSS_BODY_CLASS {
background-image: url(../../../../images/anyimage.png);
/*overflow: hidden;*/
background-repeat: no-repeat;
background-position: center top;
background-size: cover;
background-attachment: fixed;
min-height: 1000px;
}
The following users have thanked you: Marni J Derr, Unay Santisteban
Time to create page: 0.046 seconds