Created
June 29, 2022 10:39
-
-
Save jpalala/df9e4accf1c671f1cf1de614e29b43af to your computer and use it in GitHub Desktop.
Svelte Slides increment POC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/* https://svelte.dev/repl/20f592923f584d6e9399392d4864e55a?version=3.48.0 */ | |
import NextPage from './NextPage.svelte'; | |
import { pageNum } from './stores.js'; | |
let page; | |
let pageNumber; | |
let slides = ["<b>i</b>", "<b>love</b>", "<b>svelte</b>"]; | |
pageNum.subscribe(value => { | |
pageNumber = value; | |
const content = slides[value - 1]; | |
loadPage(content); | |
}); | |
function loadPage(content) { | |
if(content == undefined || content == null) { | |
//alert("cant load it sorry"); | |
} else { | |
let ewanpage = document.querySelector(".ewan"); | |
ewanpage.innerHTML = content; | |
} | |
} | |
</script> | |
<div class="ewan">This should be strong.</div> | |
<NextPage /> | |
{pageNumber} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import App from './App.svelte'; | |
var app = new App({ | |
target: document.body | |
}); | |
export default app; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { pageNum } from './stores.js'; | |
function nextPagePlease() { | |
pageNum.update(n => n + 1); | |
} | |
</script> | |
<button on:click={nextPagePlease}> | |
Next | |
</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { writable } from 'svelte/store'; | |
export const pageNum = writable(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment