0

How can i link two images to each other in a single web page??

Like, I click on 1st img then 2nd img takes its place and when I click on 2nd img then 1st img takes it's place , and this happens with every clicking.... Sorry for bad English.. 🙏🙏

25th Apr 2020, 11:21 AM
𝕄𝕪𝕤𝕥𝕖𝕣𝕪
𝕄𝕪𝕤𝕥𝕖𝕣𝕪 - avatar
16 ответов
+ 5
Html alone cannot be interactive with user actions... but you could avoid JS by using Css instead (wich could handle some interactivity/dynamic changes of the html styling): https://code.sololearn.com/W60C4KtmAtTU/?ref=app
25th Apr 2020, 7:06 PM
visph
visph - avatar
+ 4
I don't have to much time to type code and then show u output. Don't keep on discussing .
27th Apr 2020, 11:21 AM
Anand Kumar
Anand Kumar - avatar
+ 2
Give the image id attributes and link to their id https://code.sololearn.com/WnOPkoeIrqd8/?ref=app
25th Apr 2020, 11:33 AM
Ore
Ore - avatar
+ 2
Why setting and removing immediatly the best answer mark on my post?
26th Apr 2020, 10:27 AM
visph
visph - avatar
+ 2
Wow! Your solution (if exists/works) would be quite hardest than your first explanation would suggest if it take more time to do than writting some posts ;P All I could imagine working as what I understand from your second post, doesn't necessarly implie ids (any good chosen css selectors will do the work and certainly not by giving the same id to differents elements) and doesn't implies JS at all: check this code of mine recently done in few minutes to show how to switch images on click (with pure Html/Css -- under the hood we use the same trick than my first linked code, but in its simplest version, as button are more complexe to handle, all the more when there are commands duplicated: ie, the switch button who do same job than the on and off buttons and reciprocally): https://code.sololearn.com/W60C4KtmAtTU/?ref=app
27th Apr 2020, 11:36 AM
visph
visph - avatar
+ 1
⚡🌀♏️ystery🌀⚡ I have updated it. I had to use javascript to handke cluck events https://code.sololearn.com/WnOPkoeIrqd8/?ref=app
25th Apr 2020, 11:57 AM
Ore
Ore - avatar
0
Ore Adeleye Maybe you did not read my description, I said that the second image should take the place of the first. But in your code both are already in page
25th Apr 2020, 11:45 AM
𝕄𝕪𝕤𝕥𝕖𝕣𝕪
𝕄𝕪𝕤𝕥𝕖𝕣𝕪 - avatar
0
Ore Adeleye thanks... But... can't I just do the same thing by only using HTML ??
25th Apr 2020, 2:20 PM
𝕄𝕪𝕤𝕥𝕖𝕣𝕪
𝕄𝕪𝕤𝕥𝕖𝕣𝕪 - avatar
0
visph thanks for help 🤗
26th Apr 2020, 10:26 AM
𝕄𝕪𝕤𝕥𝕖𝕣𝕪
𝕄𝕪𝕤𝕥𝕖𝕣𝕪 - avatar
0
Technical Master sure you cannot do with only html, but you're not mandatory to use js: you could use only css (with html obviously)... check my code posted previously ;)
26th Apr 2020, 12:02 PM
visph
visph - avatar
0
In this case image id should be same but source be different. After that make a button and call it by id. By same id of two different images if u click button 1st times get 1st image and another u get 2nd image on same place in same web page. 😊😊
27th Apr 2020, 9:48 AM
Anand Kumar
Anand Kumar - avatar
0
Anand Kumar can you show an example??
27th Apr 2020, 9:55 AM
𝕄𝕪𝕤𝕥𝕖𝕣𝕪
𝕄𝕪𝕤𝕥𝕖𝕣𝕪 - avatar
0
⚡🌀♏️ystery🌀⚡ More of less like this: https://code.sololearn.com/Wkx3lK98uFpB/?ref=app Anand Kumar not sure to good understand your idea: I doubt of your explanation of both image with same id wich magically get switched (by selecting by id, you will ever get the first element with the matching id encountered, and never others ^^)
27th Apr 2020, 10:02 AM
visph
visph - avatar
0
I am unable to show u here bro but an example i kept here:- just on/off of bulb. In place of bulb has two different images one is glow state and another off state. By clicking it came one by one.
27th Apr 2020, 11:13 AM
Anand Kumar
Anand Kumar - avatar
0
Yes, you describe the primary goal, we are ok... but it's your "magic" that I cannot figure ^^ Why are you unable to show us? :o
27th Apr 2020, 11:18 AM
visph
visph - avatar