Skip to content

a easy way to create basic single page application without even using things like router

License

Notifications You must be signed in to change notification settings

pushkarydv/basic-single-page-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

basic-single-page-application

a easy way to create basic single page application without even using things like router

example url

usage

  • add cdn link to your html file in end of body

    <script src="https://cdn.jsdelivr.net/gh/pushkarydv/basic-single-page-application@main/index.js"></script>
  • add a script just after cdn

  • adding pages

    give id to a section of page and then add it using inbuilt function

    <section id="page1"></section>

    you can add as many pages as you want

    addPage("page1");

    this will basically hide it from page and it will be called when url changes fir example

    https://basicspa.vercel.app/#three this page will only show section of id three other all pages added will be hidden

  • setting main page of app

    setMainPage("one");
  • finally initialize it all

    pagesInit();
  • redirect without refreshing

    <a href="#one" class="pageLink" onclick="goToPage('one')">go to one</a>

About

a easy way to create basic single page application without even using things like router

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published