my cards are not coming in front of the other cards when i drag them <!DOCTYPE html>…
- User
my cards are not coming in front of the other cards when i drag them
- Assistant
The issue you're facing with cards not coming to the front when you drag them is related to the way you're handling the z-index logic. When you set the
z-indexin thebringCardToFrontfunction, you're setting the value to1000. While this brings the card to the front initially, it's important to ensure that as you add more cards and interact with them, subsequent interactions don't push them back.To fix this, you can maintain a global
zIndexCountervariable that increments each time a card is brought to the front. This ensures there's always a consistent order whenever a card is interacted with. Here's how you can adjust your code:javascript