Skip to content
Advertisement

Expand background jQuery trigger not working

The goal is when you click on the image behind the red square, the red square expands to the whole webpage.

enter image description here

But the moment after you clicked on the image the transition plays like this…

enter image description here

enter image description here

…and ended like this.

enter image description here

when you click on the red expanded square it transitions perfectly back to this, but in a different shape not where it was at the beginning.

enter image description here

JavaScript
JavaScript
JavaScript

I added .w-full { width: 100%; } in jQuery to expand the red square to the full width of the whole webpage and that didn’t work.

Advertisement

Answer

This is my version of the code.

The change is quite small, just this

JavaScript

to this

JavaScript

If you debug your HTML tree in your code after you click the box twice, you will be able to see that .expandBG is fine. It’s sticking to the correct sizing that you are giving it (50×50). The problem comes from your .text-portf still having the height of 50vw (applied from content-portf CSS). It’s basically overflowing the container .expandBG. You can see that yourself by adding

JavaScript

to .expandBG css.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement