Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Full page background slide show

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 298
    Comment on it

    Hello Readers,

    To make full page background slide show I have used the below mention code. The code is very simple. If you want full background slide show in your website you can easily use this code.

    Here is the demo for background images slide show.

    **HTML**

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Background Slide Show</title>
    </head>
    <body>
    	<section id="home">
    		    	
    
    	</section>
    </body>
    </html>

     

    *CSS*
     

    *{
    	padding: 0px;
    	margin: 0px;
    }
    
    body{
    	font-family: Arial, Verdana;
    	font-size: 2em;
    	line-height: 1.5em;
    	height: 100vh;
    }
    
    html, section{
    	height: 100vh;
    }
    
    img{
    	max-width: 100%;
    }
    
    #home{
    	height: 100%;
    	background-attachment: fixed;
    	background-size: cover;
    }

     

    *JS*
     

    var images = ["one.png", "two.png", "three.png", "four.jpg", "five.jpg", "six.jpg", "seven.jpg"];
      $(function () {
        var i = 0;
        $("#home").css("background-image", "url(images/" + images[i] + ")");
        setInterval(function () {
            i++;
            if (i == images.length) {
                i = 0;
            }
            $("#home").fadeOut("slow", function () {
                $(this).css("background-image", "url(images/" + images[i] + ")");
                $(this).fadeIn("slow");
            });
        }, 8000);
      });

    I Hope this code and article both will very helpful for you. :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: