Jnap Posted August 23, 2021 Share Posted August 23, 2021 Site URL: https://www.originexpeditions.org/caltopo-guide Scroll down to "A Tour of CalTopo's Interface." For some reason, whenever it does the image swap it changes the size of the picture. The two images injected in the code are the exact same size so I have no idea why this is happening, it should look like a smooth transition. It does this for every image swap on the page. Here is my CSS: .image-swap img:nth-child(1) { position: absolute; transition: .5s;} .image-swap img:nth-child(1):hover { opacity:0; } .image-swap2 img:nth-child(1) { position: absolute; transition: 1s; } .image-swap2 img:nth-child(1):hover { opacity:0; } .image-swap3 img:nth-child(1) { position: absolute; transition: 1s; } .image-swap3 img:nth-child(1):hover { opacity:0; } .image-swap4 img:nth-child(1) { position: absolute; transition: 1s; } .image-swap4 img:nth-child(1):hover { opacity:0; } .image-swap5 img:nth-child(1) { position: absolute; transition: 1s; } .image-swap5 img:nth-child(1):hover { opacity:0; } .image-swap6 img:nth-child(1) { position: absolute; transition: 1s; } .image-swap6 img:nth-child(1):hover { opacity:0; } Link to comment
tuanphan Posted August 26, 2021 Share Posted August 26, 2021 Hi, Do you still need help? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
creedon Posted September 4, 2021 Share Posted September 4, 2021 Try the following for the basic swap effect. /* begin image swap */ .image-swap { position : relative; } .image-swap img:last-child { left : 0; opacity : 0; position : absolute; top : 0; transition-duration : 0.5s; } .image-swap:hover img:last-child { opacity : 1; transition-duration : 1s; } /* end image swap */ This is for a v7.1 site. If all your image swaps are going to be the same then you could use just the one rule-set group. Just change all your code blocks to match the .image-swap selector. Let us know how it goes. tuanphan 1 Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
Jnap Posted September 13, 2021 Author Share Posted September 13, 2021 Creedon, I guess I somehow didn't see your post! That worked great, thank you very much. tuanphan and creedon 1 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment