Skip to content

buzzcosm/splash-page-vanilla-js-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Splash Page

Exercise Project of ZTM Cours on Udemy (JavaScript Web Projects: 20 Projects to Build Your Portfolio).

Description

Programmed in vanilla-js. Working with Figma design.

Great algorithm for switching the background!

function changeBackground(number) {
  // Check if background is already showing
  let previousBackground;
  if (body.className) {
    previousBackground = body.className;
  }
  // Reset CSS class for body
  body.className = '';
  switch (number) {
    case '1':
      return (previousBackground === 'background-1') ? false : body.classList.add('background-1');
    case '2':
      return (previousBackground === 'background-2') ? false : body.classList.add('background-2');
    case '3':
      return (previousBackground === 'background-3') ? false : body.classList.add('background-3');
    default:
      break;
  }
}

Interesting things

Useful references

About

ZTM Cours (javaScript Web Projects) - No. 18: Splash Page (Figma Design)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published