Skip to content

Optimize first painting of image #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ezhlobo
Copy link

@ezhlobo ezhlobo commented Jun 10, 2015

Load window and document dimensions when script is loaded, because they are available before DOM.

Now we load this variables when window is fully loaded ($win.on('load')) and call requestRender. But in Parallax constructor we use another trigger to calling requestRender: onload of mirrors image (this.$slider.one('load')).

The second event fired before the first. This is the reason of wrong calculation of top.

Load window and document dimensions when script is loaded, because they are available before DOM
Parallax.requestRender();
});

loadDimensions();
loadScrollPosition();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this not be achieved with a simple

$win.trigger('load.px.parallax');

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want execute refresh and requestRender few more times as it would be when just triggering load.

wstoettinger added a commit to wstoettinger/parallax.js that referenced this pull request Oct 1, 2015
This appends a whole DOM element to the parallax mirror (utilizing the
same ".parallax-slider" class).

so far it only works properly when setting the naturalWidth and
naturalHeight options in the JS initialization. Somebody got a tip on
how to improve that?

I'm planning to implement a parallax carousel which should be possible
with that change.

also performance improvement suggestions from pixelcog#71
@wstoettinger
Copy link
Collaborator

this is included in #88 which got merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants