Hey folks, I wrote this code to create 2 * 2 grid layout for cards with dot navigation.
It seems to be working but card has to be multiple of 4. If there are 9 cards (which is in the example code) the last dot in the navigation renders wrong card. I've concatenated js/css/html in one page for ease.
Codepen:
https://codepen.io/Abhi1234567890/pen/yLxLGXV
4 Replies
I think a CodePen would be more helpful to be fair.
Sure, here it is - https://codepen.io/Abhi1234567890/pen/yLxLGXV
you can adjust your for loop condition a bit to make sure the index does not exceed the amount of cards
Thank you so much ! It works ! You are amazing ! My brain could not comprehend that logic.