Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <!-- Global site tag (gtag.js) - Google Analytics -->
- <script async="" src="https://www.googletagmanager.com/gtag/js?id=G-420XFJRS1M"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag() {
- dataLayer.push(arguments);
- }
- gtag('js', new Date());
- gtag('config', 'G-420XFJRS1M');
- </script>
- <link rel="shortcut icon" href="https://1xpto.netlify.app/items/favicon.gif" type="image/x-icon">
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="keywords" content="Javascript Slideshow Carousel">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Javascript Slideshow Carousel</title>
- <style>
- #flex_box {
- display: flex;
- overflow-x: scroll;
- }
- #image {
- box-sizing: border-box;
- width: 500px;
- height: auto;
- border: 5px solid red;
- padding: 5px;
- margin: 0 5px;
- }
- body {
- margin: 0;
- }
- .header {
- color: navy;
- font-family: arial black;
- font-size: 4vw;
- text-align: center;
- }
- @media all and (orientation: portrait) and (max-width: 425px) {
- .header {
- font-size: 8vw;
- }
- #image {
- width: 100%;
- height: auto;
- margin: 1px 0;
- }
- #flex_box {
- flex-direction: column;
- }
- body {
- overflow-y: scroll;
- }
- }
- @media all and (orientation: landscape) and (max-width: 640px) {
- .header {
- font-size: 7vw;
- }
- #image {
- width: 100%;
- height: auto;
- margin: 1px 0;
- }
- #flex_box {
- flex-direction: column;
- }
- body {
- overflow-y: scroll;
- }
- }
- </style>
- </head>
- <body>
- <h1 class='header'>JavaScript Carousel <br> Gif Fullscreen Onclick </h1>
- <div id='flex_box'></div>
- <script>
- carousel = ['https://1xpto.netlify.app/gif/gif1.gif', 'https://1xpto.netlify.app/gif/gif2.gif', 'https://1xpto.netlify.app/gif/gif3.gif', 'https://1xpto.netlify.app/gif/gif4.gif', 'https://1xpto.netlify.app/gif/gif5.gif', 'https://1xpto.netlify.app/gif/gif6.gif', 'https://1xpto.netlify.app/gif/gif7.gif', 'https://1xpto.netlify.app/gif/gif8.gif'];
- title = ['Roller coaster', 'Feeling like trash', 'Getting dizzy', 'Burn out', 'Too much caffeine', 'Fiddler joy', 'Getting sleepy', 'Studying with view'];
- for (i = 0; i < carousel.length; i++) {
- image = document.createElement('img');
- document.body.appendChild(image);
- flex_box.appendChild(image);
- image.id = 'image';
- image.src = carousel[i];
- image.title = title[i];
- }
- function fullscreen() {
- img = document.getElementsByTagName("img");
- for (i = 0; i < img.length; i++) {
- img[i].addEventListener("click", getFull);
- }
- function getFull(e) {
- e.target.requestFullscreen();
- }
- }
- fullscreen();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement