javascript - jQuery Scrolly plugin - parallax background jumps by preceding element's height -
demo: http://christianbullock.org/jstest/
i'm trying implement basic parallax banner on freelance project. i'm using: https://github.com/victa/scrolly
problem though. when there's element placed before parallax banner, when begin scrolling, parallax background's position jump height of preceding element.
in case, red banner 218px high. when begin scrolling, green background's position jump 218px.
note: isn't problem if parallax element first element on page. it's not problem if red banner removed document flow through fixed positioning.
i'm thinking culprit this, wouldn't know begin diagnosing:
// fix background position if(this.bgstart){ position = position + this.bgstart; } if(this.options.bgparallax === true) { this.$element.css({backgroundposition: '50% '+position+'px'}); } else { this.$element.css({top: position}); }
really appreciate pointers. thanks! :)
fixed. had add:
data-fit="-218"
to account banner @ top :)
Comments
Post a Comment