vvo / in-viewport

Get a callback when any element becomes visible in a viewport (body or custom viewport)
MIT License
276 stars 24 forks source link

server rendering #18

Closed revolunet closed 8 years ago

revolunet commented 8 years ago

Hi !

I have an issue when pre-rendering pages from server when using in-viewport. classic access to unknow global.document. i fixed quickly here https://github.com/revolunet/in-viewport/commit/57e5db365aee600af91d7164313b7355ff9f456b tell me if you want a PR

Cheers and thanks for that nice lib :)

tzi commented 8 years ago

Seems great for me! A PR would be nice :)

vvo commented 8 years ago

Do you use the in-viewport feature server side? I wonder how it works :D If you do not use it then maybe you can try to not include it.

Other than that I think an easier fix might be to make contains a function declaration rather than a variable like that. So that the code is only executed when relevant.

Also did you see https://github.com/camwiegert/in-view? At some point I might depreciate this is https://github.com/camwiegert/in-view goes well. They are basically adding features from in-viewport

revolunet commented 8 years ago

Thanks for the feedback !

i'm playing with the great phenomic.io and it prerenders all pages and breaks on every browser-only lib

thanks for in-view looks nice, will try

vvo commented 8 years ago

Other than that I think an easier fix might be to make contains a function declaration rather than a variable like that. So that the code is only executed when relevant.

Can you do that instead? Would be better I think

revolunet commented 8 years ago

yep its better :)

i have some trouble running the saucelabs tests though..

vvo commented 8 years ago

i have some trouble running the saucelabs tests though..

No big deal, they are somehow broken that's ok. Your change should be OK