Website Programming: Loop SlideShow Images Pure HTML, JavaScript, and CSS in Responsive Way
HTML
First, we have to put <head> as the first section. In <head> we can put a responsive coding circle like<meta....>( so, the website being able to react quickly to automatically adjust for different screen size ) and we can link to an external file. In this case, we have to add another link it's <link rel = "stylesheet" href = "https://unpkg.........> we got the link from google to link to a website which offers swiper images.
In this section, we put all the images we need to display on the website. Basically <body> is a place where we put many contents inside like text, images, videos, songs, etc. In this lesson, JavaScript is the main stage and HTML&CSS is just a supporter.
JavaScript in the HTML (it's called internal)
I put the JavaScript in the HTML file, why? Because the coding is simple and didn't require many rows. If you want, you can also put CSS in the HTML file but if you don't' want to get confused then I suggest using an external link.
As you can see that the JavaScript put the function/order inside, like "loop: true", it means I'm going to make a loop of images from the first image to the last image and will continue the loop.
CSS ( style.css) external link
The * in CSS means all elements, it's a universal selector. So we are setting all elements to have zero margins and zero paddings, thus making them look the same in the browser and responsive so the website being able to react quickly to automatically adjust for different screen sizes. For the swiper- the container is just like a box, we make a box so the text and the display can be separated from the others( if you want to put something else on the website like text, pictures, etc).
While we put images as a group in a place, we have to set the slide like "what is your picture's size?" I used 300 x 300 pixels (I recommended this size because it's used to use on Instagram and really fit in any device like a smartphone, tablet, i-pad, and many other devices.
Basically, in this lesson JavaScript is the main stage, you need the function you need the order and to make it happen then, JavaScript is the answer. In this lesson I mean JavaScript is a low level of coding. But, if you're confused about the codes and get an error. You can just download all the files include images ( 300 x 300 pixels), HTML, javascript, and CSS file. Just click the link below
Comments
Post a Comment