alvarotrigo / vue-fullpage.js

Official Vue.js wrapper for fullPage.js http://alvarotrigo.com/vue-fullpage/
GNU General Public License v3.0
1.85k stars 255 forks source link

Move to the first section inside another component that doesn't contain the fullpage initialization object #254

Closed synoloris closed 2 years ago

synoloris commented 2 years ago

I have different sections to scroll through. In the footer I have an arrow to scroll back to top of the page. If i scroll back to the top; the fullpage scroll doesn't work anymore.

I have no access to the fullpage JS initialization becauce it's not in the same vue component. If i had, I would use fullpage.moveTo(1);.

So, I'm trying to remove all CSS adjustements done by fullpage JS to return to the top of the page - is this possible?

The sections parent has the id #sections. This is what I've done so far:

document.getElementById('sections').style.removeProperty('top');
document.getElementById('sections').style.removeProperty('transform');
window.document.body.className = 'fp-viewing-0';
document.getElementsByClassName('fp-completely')[0].classList.remove('active', 'fp-completely');
document.getElementsByClassName('firstSection')[0].classList.add('active', 'fp-completely');

Thanks.

alvarotrigo commented 2 years ago

I have no access to the fullpage JS initialization becauce it's not in the same vue component. If i had, I would use fullpage.moveTo(1);.

Can't you use the window object for it? fullpage_api is exposed to the window.

fullpage_api.moveTo(1);
synoloris commented 2 years ago

Thanks for the quick response. Yes, that's it, I didn't know I could access it by window.

alvarotrigo commented 2 years ago

Glad it helped! ;)