Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .mainview {
- background-image: url(images/bg-1.png);
- height: 600px;
- background-repeat: no-repeat;
- background-size: cover;
- background-position: bottom center;
- background-attachment: fixed;
- position: relative;
- top: 12px
- }
- <script type="text/javascript">
- var images = ['image-1.jpg', 'image-2.jpg', 'image-3.jpg', 'image-4.jpg'];
- document.getElementsByClassName('mainview')[0].style.backgroundImage = 'url(' + images[Math.floor(Math.random() * images.length)] + ')';
- </script>
Add Comment
Please, Sign In to add comment