Tailwind Dropdown Help #19197
Unanswered
Partymann2000
asked this question in
Help
Replies: 2 comments
-
|
Maybe z-index issue boss.. Or u maybe not import tailwindcss at the top level of your global.css/index.css file |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Hello! The dropdown visibility issue is likely due to CSS stacking context or positioning. Here's the corrected implementation: Updated Dropdown Structure: <nav class="bg-black text-gray-100 p-4 shadow-lg relative">
<div class="absolute inset-0 bg-gradient-to-r from-blue-900 via-purple-900 to-pink-900 opacity-20 animate-gradient"></div>
<div class="container mx-auto flex items-center justify-between relative z-10">
<div class="flex items-center space-x-4">
<div class="relative hidden lg:block" ref="langDropdownContainer">
<button
@click="toggleLangDropdown"
class="flex items-center gap-2 px-3 py-2 bg-primary-800 rounded-md hover:bg-primary-700 transition-colors text-sm relative z-20"
>
<span>{{ currentLanguage?.flag }}</span>
<span>{{ currentLanguage?.name }}</span>
<ChevronDownIcon class="h-4 w-4 text-gray-400" />
</button>
<div
v-if="langDropdownOpen"
class="absolute top-full left-0 mt-1 w-48 bg-primary-800 border border-primary-700 rounded-md shadow-xl z-50 transform origin-top"
>
<button
v-for="lang in availableLanguages"
:key="lang.id"
@click="selectLanguage(lang.id)"
class="w-full flex items-center gap-3 px-4 py-3 text-left text-sm hover:bg-primary-700 transition-colors first:rounded-t-md last:rounded-b-md"
>
<span class="text-lg">{{ lang.flag }}</span>
<span class="font-medium">{{ lang.name }}</span>
</button>
</div>
</div>
</div>
</div>
</nav>Key Fixes Applied:
Additional CSS if needed: .dropdown-enter-active {
transition: all 0.2s ease-out;
}
.dropdown-leave-active {
transition: all 0.15s ease-in;
}
.dropdown-enter-from,
.dropdown-leave-to {
opacity: 0;
transform: scale(0.95);
}The main issue was likely the missing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
this is my problem, the navbar is not showing as a popup
https://github.com/user-attachments/assets/f9a137b6-f625-47cc-871c-ae56b194b45a
this is my code
Beta Was this translation helpful? Give feedback.
All reactions