0% ont trouvé ce document utile (0 vote)
4 vues7 pages

Animations et gestion de thème CSS

Transféré par

medjomarcelmiguel
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats DOCX, PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
4 vues7 pages

Animations et gestion de thème CSS

Transféré par

medjomarcelmiguel
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats DOCX, PDF, TXT ou lisez en ligne sur Scribd

// Animation d’apparition des titres

[Link](‘.titre’).[Link] = ‘0’ ;

[Link](‘.titre’).[Link] = ‘opacity 1s’ ;

[Link](‘.titre’).[Link] = ‘1’ ;

// Animation de disparition des titres par opacité

[Link](‘.titre’).[Link] = ‘0’ ;

// Animation de disparition par opacité de la page actuelle et d’apparition de la suivante

Function changerTheme() {

[Link] = ‘0’ ;

setTimeout(() => {

if ([Link] === ‘white’) {

[Link] = ‘black’ ;

[Link] = ‘white’ ;

[Link](‘.formulaire’).[Link] = ‘yellow’ ;

[Link](‘input’).forEach(input => [Link] = ‘red’) ;

[Link](‘button’).[Link] = ‘yellow’ ;

[Link](‘h1’).forEach(titre => {

[Link] = ‘white’ ;

[Link] = ‘green’ ;

}) ;

} else {

[Link] = ‘white’ ;

[Link] = ‘black’ ;

[Link](‘.formulaire’).[Link] = ‘green’ ;

[Link](‘input’).forEach(input => [Link] = ‘yellow’) ;

[Link](‘button’).[Link] = ‘red’ ;

[Link](‘h1’).forEach(titre => {

[Link] = ‘black’ ;

[Link] = ‘white’ ;
}) ;

[Link] = ‘1’ ;

}, 1000) ;

// Stocker le choix du thème dans un cookie

Function setCookie(cname, cvalue, exdays) {

Const d = new Date() ;

[Link]([Link]() + (exdays * 24 * 60 * 60 * 1000)) ;

const expires = « expires= »+[Link]() ;

[Link] = cname + « = » + cvalue + « ; » + expires + « ;path=/ » ;

Function getCookie(cname) {

Const name = cname + « = » ;

Const decodedCookie = decodeURIComponent([Link]) ;

Const ca = [Link](‘ ;’) ;

For(let i = 0 ; i <[Link] ; i++) {

Let c = ca[i] ;

While ([Link](0) == ‘ ‘) {

C = [Link](1) ;

If ([Link](name) == 0) {

Return [Link]([Link], [Link]) ;

Return « « ;

If ( !getCookie(« theme »)) {


setCookie(« theme », « white », 365) ;

If (getCookie(« theme ») === « dark ») {

changerTheme() ;

// Animation d’apparition des titres

[Link](‘.titre’).[Link] = ‘0’ ;

[Link](‘.titre’).[Link] = ‘opacity 1s’ ;

[Link](‘.titre’).[Link] = ‘1’ ;

// Animation de disparition des titres par opacité

[Link](‘.titre’).[Link] = ‘0’ ;

// Animation de disparition par opacité de la page actuelle et d’apparition de la suivante

Function changerTheme() {

[Link] = ‘0’ ;

setTimeout(() => {

if ([Link] === ‘white’) {

[Link] = ‘black’ ;

[Link] = ‘white’ ;

[Link](‘.formulaire’).[Link] = ‘yellow’ ;

[Link](‘input’).forEach(input => [Link] = ‘red’) ;

[Link](‘button’).[Link] = ‘yellow’ ;

[Link](‘h1’).forEach(titre => {

[Link] = ‘white’ ;

[Link] = ‘green’ ;

}) ;

} else {

[Link] = ‘white’ ;

[Link] = ‘black’ ;
[Link](‘.formulaire’).[Link] = ‘green’ ;

[Link](‘input’).forEach(input => [Link] = ‘yellow’) ;

[Link](‘button’).[Link] = ‘red’ ;

[Link](‘h1’).forEach(titre => {

[Link] = ‘black’ ;

[Link] = ‘white’ ;

}) ;

[Link] = ‘1’ ;

}, 1000) ;

// Stocker le choix du thème dans un cookie

Function setCookie(cname, cvalue, exdays) {

Const d = new Date() ;

[Link]([Link]() + (exdays * 24 * 60 * 60 * 1000)) ;

const expires = « expires= »+[Link]() ;

[Link] = cname + « = » + cvalue + « ; » + expires + « ;path=/ » ;

Function getCookie(cname) {

Const name = cname + « = » ;

Const decodedCookie = decodeURIComponent([Link]) ;

Const ca = [Link](‘ ;’) ;

For(let i = 0 ; i <[Link] ; i++) {

Let c = ca[i] ;

While ([Link](0) == ‘ ‘) {

C = [Link](1) ;

If ([Link](name) == 0) {

Return [Link]([Link], [Link]) ;


}

Return « « ;

If ( !getCookie(« theme »)) {

setCookie(« theme », « white », 365) ;

If (getCookie(« theme ») === « dark ») {

changerTheme() ;

// Animation d’apparition des titres

[Link](‘.titre’).[Link] = ‘0’ ;

[Link](‘.titre’).[Link] = ‘opacity 1s’ ;

[Link](‘.titre’).[Link] = ‘1’ ;

// Animation de disparition des titres par opacité

[Link](‘.titre’).[Link] = ‘0’ ;

// Animation de disparition par opacité de la page actuelle et d’apparition de la suivante

Function changerTheme() {

[Link] = ‘0’ ;

setTimeout(() => {

if ([Link] === ‘white’) {

[Link] = ‘black’ ;

[Link] = ‘white’ ;

[Link](‘.formulaire’).[Link] = ‘yellow’ ;

[Link](‘input’).forEach(input => [Link] = ‘red’) ;

[Link](‘button’).[Link] = ‘yellow’ ;

[Link](‘h1’).forEach(titre => {
[Link] = ‘white’ ;

[Link] = ‘green’ ;

}) ;

} else {

[Link] = ‘white’ ;

[Link] = ‘black’ ;

[Link](‘.formulaire’).[Link] = ‘green’ ;

[Link](‘input’).forEach(input => [Link] = ‘yellow’) ;

[Link](‘button’).[Link] = ‘red’ ;

[Link](‘h1’).forEach(titre => {

[Link] = ‘black’ ;

[Link] = ‘white’ ;

}) ;

[Link] = ‘1’ ;

}, 1000) ;

// Stocker le choix du thème dans un cookie

Function setCookie(cname, cvalue, exdays) {

Const d = new Date() ;

[Link]([Link]() + (exdays * 24 * 60 * 60 * 1000)) ;

const expires = « expires= »+[Link]() ;

[Link] = cname + « = » + cvalue + « ; » + expires + « ;path=/ » ;

Function getCookie(cname) {

Const name = cname + « = » ;

Const decodedCookie = decodeURIComponent([Link]) ;

Const ca = [Link](‘ ;’) ;

For(let i = 0 ; i <[Link] ; i++) {


Let c = ca[i] ;

While ([Link](0) == ‘ ‘) {

C = [Link](1) ;

If ([Link](name) == 0) {

Return [Link]([Link], [Link]) ;

Return « « ;

If ( !getCookie(« theme »)) {

setCookie(« theme », « white », 365) ;

If (getCookie(« theme ») === « dark ») {

changerTheme() ;

Vous aimerez peut-être aussi