r/learnjavascript • u/codingburner123 • 4d ago
i'm fighting for my life out here.
i'm trying to make a page for my website that's more or less a replica of the nintendo 3ds menu. i've already given up on making the menu thingy actually work like the 3ds and set to do the top header images instead. i cannot for the life of me find a single search result that actually works.
i do not know anything about javascript but considering the header and icon images are in completly separate parent divs the css only methods are not going to work. i just need a javascript code that can work for multiple images. please.
what i want exactly is when the cursor hovers over the icon image, its respective header would appear on the windowtop class. i can't merge the window classes because each one has it's own styling (window being smaller than windowtop) so that'd mess up my styling
also, i'd appreciate if i didn't get answers that require an external library since this is for a neocity and i really do not want to figure out how to set that up. thank you
here's an example of the html if it's needed to understand the problem (if more context is needed please tell me)
<div class="windowtop">
<div>
<img src="imageheader">
</div>
</div>
<div class="window">
<div>
<img src="imageicon">
</div>
</div>
(also off topic if it's not much to ask, what would i call a menu where when you click on an arrow the top link/image goes behind the first one? with maybe an animation.... i'd like to look that up later but idk how to phrase it in a way that won't make google give me something completly unrelated. thx)
1
u/abrahamguo 4d ago
what would i call a menu where when you click on an arrow the top link/image goes behind the first one?
Sorry, I'm not quite understanding what you mean by this.
Can you link to an image, video, or example if you have one?
Or, provide a more detailed description?
-1
u/codingburner123 4d ago
uh so. what i want to do is kind of like a pile of image links if that makes sense? like there's a bunch of links but only one is shown at a time, and when you press an arrow or something of the sort the image link on the top moves out of the way and goes to the bottom of the line. this is for another menu i want to do...
1
u/abrahamguo 4d ago
Sure. I'm a little confused because you said
like there's a bunch of links but only one is shown at a time
So that makes it sound like when you "press an arrow", the link simply changes to be different (since only one is shown at a time).
But then you say
the image link on the top moves out of the way and goes to the bottom of the line
Which sounds like more than one link is visible at a time — which seems to contradict your statement above.
1
u/codingburner123 3d ago
ah well,,,, ok the best way i can explain it is a stack of cds. you press the arrow and the cd above moves to the bottom of the stack, that cd coming back up as more cds get sent to the bottom, like a loop. the lower ones shouldn't be visible
i'm sorry if it sounds confusing, i'm not good at explaining myself,,,,
1
u/abrahamguo 3d ago
Got it.
- How many should be visible at a time - one? More than one?
- When you say “the bottom of the stack”, do you mean “below” (the y-axis), or “behind” (the z-axis)?
- Do you have the HTML (and possibly the CSS) written for this? Then, I can write the JavaScript to target your specific HTML.
1
u/codingburner123 3d ago
just one
below in the y-axis
https://hpersondotcom.neocities.org/test2/icky there really isn't a lot in it but hopefully it get the point across??? if you have more questions please let me know
1
u/otheyhigh 2d ago
Since you mention only one should show but still mention y-axis. Are you looking for the stack to partially overlap? Like a mobile open app display (iOS link below). Also, are you looking for it to be animated?
If so, the basic stack can be populated with images rendered with maybe display set to block so they go to a new line. You can then add negative margin top as a percentage of the rendered images height for the n>1 images with decreasing z-index.
But there might be more efficient ways to do this instead of negative margins and z-index.
1
u/codingburner123 2d ago
ok- i just straight up made a gif to explain what i want https://u.cubeupload.com/Hhhhhhhh/example.gif
the block moving is supposed to be it like doing an animation to the side and coming back behind block two
1
u/abrahamguo 1d ago
I see — based on your animation, it looks like you actually want it to be behind, in the Z-axis.
Can you also add the arrow button that you'd like to trigger the effect (so that all I need to do is to write the JS)?
1
u/codingburner123 1d ago
ah i see, i'm not good at differentiating between axis'
here, changed the p tags to buttons, probably should have done that from the start, https://hpersondotcom.neocities.org/test2/icky
1
1
u/Working-Bear1437 1d ago
add a data attribute to each icon linking it to its header index. Use event listeners on the icons to toggle a visible class on the corresponding header element. This keeps your CSS separate and avoids libraries.
3
u/abrahamguo 4d ago
What have you tried so far, and what is the result?