What you want to create is called a Carousel. You can look it up online, there are guides for creating one with a bit of Javascript.
Off the top of my head, you can either load all the images when the page loads into an array, and then each button triggers a JS function that cycles to the next or previous image on the array; or you only load the first and the ones next to them and when you move to the next or previous, you load the next appropriate set from the server. First option is easier
The way I read it, your suggestion was to have one whole HTML page per image. Then the buttons link to those pages. Clicking a button would leave the current page and load another.
If this is what you meant, having more than three images would immediately become extremely cumbersome and honestly, plain ridiculous. This can be done with a simple list of images and some basic JS
Yeah of course it is an untenable implementation. It's a jumping off point for learning. It's the simplest and easiest implementation to conceptualize.
The next step would be, how do I do this without having to effectively having a copy of the page with a different image every time.
You said you had "no idea how to approach this". So I'm just giving you the FIRST idea. If you know JS and it's so obvious why the heck are you asking this question???
1
u/Useful-Flow-8737 3d ago
In what context? Web?
1
u/vancha113 3d ago
mm maybe with an onclicklistener for the button, that sets the <img> src property to another value? You could even add a fancy transition to it.
1
u/xarop_pa_toss 3d ago
What you want to create is called a Carousel. You can look it up online, there are guides for creating one with a bit of Javascript.
Off the top of my head, you can either load all the images when the page loads into an array, and then each button triggers a JS function that cycles to the next or previous image on the array; or you only load the first and the ones next to them and when you move to the next or previous, you load the next appropriate set from the server. First option is easier
1
u/marmotta1955 3d ago
Well, if you have no clue on how to approach coding ... how would you know if it is really fun and cool?
1
u/SofyWindows32 1d ago
Mimo is a good app to learn such things
0
u/nullptr_0x 3d ago
Do you know the basics of html?
If you do, create a page that has this structure.
Then copy that page 2 more times. Each image reference references 1 of 3 images.
Then what would the "arrows" point two?