When the window size is reduced, the navigation vanishes

Whenever I resize the window, the navigation bar disappears. Here is the image of the page before resizing the window https://i.sstatic.net/UiRB9.png

Below is the image after resizing the window

https://i.sstatic.net/X00d2.png

Displayed below is the code in default.vue

<template>
  <v-app>
    <Header />
    <div class="d-flex flex-0-1-100">
      <SideMenu />
      <v-main class="pl-0">
        <v-container>
          <slot />
          <NavigationLink />
        </v-container>
      </v-main>
      <TableofContents />
    </div>
    <Footer />
  </v-app>
</template>

Shown below is the code for SideMenu.vue

<script setup lang="ts">
import { computed } from 'vue';
import { useLayout } from 'vuetify';

const { mainStyles } = useLayout();
const marginTop = mainStyles.value['--v-layout-top'];
const maxHeight = computed(
  () => `calc(100vh - ${mainStyles.value['--v-layout-top']})`
);
// more code here ...
</script>
<template>
  <!-- Code for Client Only -->
</template>

<style scoped lang="scss">
a {
  color: $color-gray-100;
}
.active {
  background-color: $color-blue;
  color: $color-white;
  font-weight: bold;
  border-radius: 4px;
  padding: 4px 8px;
}
</style>

Is there a way to prevent the navigation content from disappearing when I resize the window? Any advice on this issue would be greatly appreciated

I have attempted the following solutions

By removing certain elements within the code of default.vue, I managed to stop the navigation from disappearing, although it did become highlighted

 <v-main class="pl-0">
   <slot />
   <NavigationLink />
 </v-main>

https://i.sstatic.net/qfiWP.png

Answer №1

To ensure the navigation remains open, utilize the permanent prop:

<v-navigation-drawer
  permanent
  ...

If you wish to hide the sidebar on smaller screens, make manual adjustments to the width of v-navigation-drawer. Otherwise, the position-sticky will prevent it from disappearing to the left:

<v-navigation-drawer
  class="position-sticky"
  v-model="drawer"
  :style="{width: drawer ? '256px' : 0 }"
  ...

playground

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ensure the computed variable is always up-to-date using Firebase in VueJS

After a successful sign-in through Firebase authentication, I need to update a navigation link. The user login changes are managed within the created hook using .onAuthStateChanged() data () { return { user: null, additionaluserinfo: nul ...

CompositeAPI: Referencing HTML Object Template - Error TS2339 and TS2533 when using .value to access Proxy Object

Having trouble referencing an element in VueJS 3 CompositeAPI. In my current implementation, it looks like this: <div ref="myIdentifier"></div> setup() { const myIdentifier = ref(null); onMounted(() => { console.log(myIden ...

Datatables - Placing Search Box outside of Data Table in Laravel with Vue.js

In my laravel/vuejs Bookstore application, I am utilizing Datatables. I want to place the search box outside of the table. However, there is an issue where the search box doesn't search the data unless the page is refreshed/reloaded 1 or 2 times. Any ...

Implementing a JavaScript function to a button within an existing form in JSP - Best practices

Currently, I am working on developing multiple JSP pages and I encountered a requirement where I needed to add a function to a button within an already existing form. The challenge was that the form's submit button was configured to navigate to anothe ...

Discovering ways to enhance time multiplication with JavaScript

My MVC model provides me with a timespan like this: timeTaken = "00:01:00"; Along with a multiplier value of multiply = "3"; The end result should be 00:03:00 What would be the most efficient way to calculate this time? I'm not well-versed in ...

JavaScript: locating web addresses in a text

Need help searching for website URLs (e.g. www.domain.com) within a document and converting them into clickable links? Here's how you can do it: HTML: Hey there, take a look at this link www.wikipedia.org and www.amazon.com! JavaScript: (function( ...

Next.js React Server Components Problem - "ReactServerComponentsIssue"

Currently grappling with an issue while implementing React Server Components in my Next.js project. The specific error message I'm facing is as follows: Failed to compile ./src\app\components\projects\slider.js ReactServerComponent ...

Storing a reference within another reference can diminish its reactivity

I'm encountering an issue with nested refs. Whenever I try to access the inner refs, I only receive back the values instead of the reactive variables. My situation involves a Pinia store, but I've simplified it down to the essential components. ...

What is the process for resolving the file paths of custom modules in node.js, whether they are absolute or relative?

require doesn't seem to recognize any path other than './parser1'. Despite placing both js files on the Desktop, attempting to run node my_parser.js always results in an error stating "Cannot find module" for relative paths like require(&apo ...

The 'style' property is not found within the 'EventTarget' type

Currently, I am utilizing Vue and TypeScript in an attempt to adjust the style of an element. let changeStyle = (event: MouseEvent) => { if (event.target) { event.target.style.opacity = 1; Although the code is functional, TypeScript consist ...

Ways to embed one block of javascript code within another block of javascript code

Can you help me with inserting the following code into a specific part of my JavaScript code? The issue I am facing is that the code contains all JavaScript, and when I directly add it, the gallery crashes. <div id='gallerysharebar'> & ...

Passing a parameter from a redirect function to an onClick in React using TypeScript

I am facing a challenge in passing a parameter to my redirectSingleLocker function. This function is intended to take me to the detailed page of a specific locker, identified by a guid. The lockerData.map method is used to display all the JSON data in a ta ...

Using Javascript to Pass Variables to Ajax with getElementById

Struggling to figure out how to effectively pass a Javascript Variable to Ajax and then post it to PHP? While both the Javascript and PHP code are functioning as expected, the challenge lies in transferring the Javascript Variable to Ajax for subsequent ...

Unable to associate Slider values with TextFields in MaterialUI

Currently, I am trying to create a slide with 2 markers to indicate a price range and interact with it on the slide. Although I have linked the input with the slider, the connection from the slider to the input is not functioning properly. My attempt was t ...

What advantages does the use of $(e).attr(name,value) offer compared to using e.setAttribute(name,value)?

Scenario: The variable "e" represents an element of type "HtmlElement" and not a "css selector" I am referring to any attribute, not just the standard allowed ones like "atom-type" or "data-atom-type". Regardless of the attribute name, will it function wi ...

Update the CSS styles using properties specified within an object

Is it possible to dynamically apply CSS styles stored in a JavaScript object to elements? For instance, can we change the width and background of a basic <div> element: <div id="box"></div> <button id="btn">click me</button> ...

What could be causing the 404 error I'm receiving for this specific URL?

Can someone explain why I keep encountering a 404 error when I type \book into the URL bar? Below is the code I am currently using: var express = require('express'), app = express(), chalk = require('chalk'), debug = ...

Problem with sidebar animation: Functioning properly when open, but closes abruptly without animation in React using Tailwind CSS

When interacting with my Menu react component by clicking on the 'hamburger' icon that I created manually, the sidebar menu opens smoothly with an animation. However, the issue arises when trying to close the sidebar as it vanishes instantly with ...

What is the best way to implement Media Queries in the Next.js application Router?

I am currently working with Next.js 13 and the App Router. Within my client component, I have implemented media queries in JavaScript to customize sidebar display for small and large screens. "use client"; export default function Feed() { co ...

What is the best way to link a mutable object with an immutable reactive object?

A unique composable function called useApplicationPreferences() is utilized in Vue 2 with the Composition API. This specific function provides access to a non-writable computed ref named darkMode: //useApplicationPreferences.ts import { reactive, computed ...