lundi 30 septembre 2019

Random image background in HTML

I want a full background changing randomly each time the page is refresh. My page is in HTML with CSS and JS (JQuery included). I've already tried a lot of solution from this website and many others, their is a lot of tutorials I know. But I think I'm doing something wrong because nothing function.

   <!DOCTYPE html>
   <html lang="fr">
     <head>
       <meta charset="UTF-8">
       <meta http-equiv="X-UA-Compatible" content="IE=edge">
       <meta name="viewport" content="width=device-width, initial-scale=1">
       <title>index</title>
       <script src="js/jquery-3.3.1.min.js"></script>
       <script src="js/popper.min.js"></script> 
       <script src="js/bootstrap-4.3.1.js"></script>

       <!-- Bootstrap -->
       <link href="css/bootstrap-4.3.1.css" rel="stylesheet">
       <style type="text/css">
       body {
    background: url(images/BG/bg01.jpg) no-repeat center center fixed; 
     -webkit-background-size: cover;
     -moz-background-size: cover;
     -o-background-size: cover;
     background-size: cover;
   }
       a:link {
       color: #000000;
   }
   a:hover {
       color: #000000;
   }
       </style>

I've got 13 backgrounds in the same folder named, bg01.jpg bg02.jpg bg03.jpg ... I don't understand how replace my url in the css part I had, where add the JS etc... Noobie topic, I'm sorry for it but I found no tuto who worked for me




Aucun commentaire:

Enregistrer un commentaire