-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Support for svelte #4552
Comments
It'd be great to have one! But happy to get any help / PR ;) |
You can try using it this way for now? <script>
import { onMount, onDestroy } from 'svelte';
export let options = {};
let fullpage;
onMount(() => {
import('fullpage.js').then((module) => {
fullpage = new module.default('#fullpage', options);
});
return () => {
if (fullpage) {
fullpage.destroy();
}
};
});
onDestroy(() => {
if (fullpage) {
fullpage.destroy();
}
});
</script>
<div id="fullpage">
<slot />
</div>
<style>
#fullpage {
height: 100vh;
}
</style> |
Usage: <script>
import FullPageWrapper from './FullPageWrapper.svelte';
const fullpageOptions = {
// Configure fullPage.js options here
};
</script>
<FullPageWrapper {options}>
<!-- Add your sections here -->
<div class="section">Section 1</div>
<div class="section">Section 2</div>
<div class="section">Section 3</div>
</FullPageWrapper>
<style>
.section {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-size: 2rem;
}
</style> |
Thanks. That works for me... slight change to your code:
|
Awesome to hear! |
The only challenge is that I can't appear to get the callback functions to trigger - example:
The function will never trigger. Apart from that it appears to be working. |
Are there plans to create a fullPage.js svelte component/plugin?
The text was updated successfully, but these errors were encountered: