Is it possible to display two menus on opposite sides of the screen while using Google Maps?

Currently, I am working on developing a Progressive Web App using Vue.js and Vuetify.js. My goal is to have two buttons overlaid on Google Maps - one on the left side of the screen to open a navigation drawer, and another on the right side to display user information.

While I successfully positioned the button on the left side as intended, I encountered difficulty in figuring out how to place the user icon on the right side.

Here is the current layout:

This is what I had envisioned:

The template structure looks like this:

<div class="overlay">
  <v-row align-content="center">
    <v-icon size="30" @click="drawer = !drawer">mdi-menu</v-icon>
    <v-spacer></v-spacer>
    <v-avatar color="teal" size="30">
      <v-icon dark>mdi-account</v-icon>
    </v-avatar>
  </v-row>
</div>
<div id="g-map"></div>

And here is my CSS styling:

<style lang="scss" scoped>
body {
  margin: 0;
  padding: 0;
}
#g-map {
  width: 100vw;
  height: 100vh;
}
.overlay {
  top: 20px;
  left: 40px;
  z-index: 1;
  position: absolute;
}
</style>

I attempted adding right: 20px; and float: right; to <v-avatar>, but it did not yield the desired outcome.

How can I achieve the expected result using Vuetify.js or css?

EDIT:

When incorporating <v-toolbar>, this is how the layout appears:

Both icons are correctly positioned on either side of the screen with this setup, however, they do not overlay Google Maps as anticipated.

Answer №1

Is that a toolbar you're working with? Make sure to enclose it within v-toolbar elements. For more details, refer to the documentation here: https://vuetifyjs.com/en/components/toolbars

<v-toolbar prominent extended>
  <v-app-bar-nav-icon></v-app-bar-nav-icon> 
  <v-spacer></v-spacer>
  <v-btn icon>
    <v-icon>mdi-account</v-icon>
  </v-btn>
</v-toolbar>

In addition to that, ensure all v-row elements are nested within v-container. v-col should be a direct child of v-row.

<v-container>
 <v-row>
   <v-col>
   </v-col>
 </v-row>
</v-container>

Answer №2

I managed to solve the issue by introducing an additional div and class. In hindsight, the solution seems quite obvious.

<div class="overlayLeft">
  <v-icon size="30" @click="drawer = !drawer">mdi-menu</v-icon>
</div>
<div class="overlayRight">
  <v-avatar color="teal" size="30">
    <v-icon dark>mdi-account</v-icon>
  </v-avatar>
</div>
<div id="g-map"></div>

As for my styles:

<style lang="scss" scoped>
body {
  margin: 0;
  padding: 0;
}
#g-map {
  width: 100vw;
  height: 100vh;
}
.overlayLeft {
  top: 20px;
  left: 20px;
  z-index: 1;
  position: absolute;
}
.overlayRight {
  top: 20px;
  right: 20px;
  z-index: 1;
  position: absolute;
}
</style>

This is the updated appearance:

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

What sets axios apart from vue-axios?

I would love to learn more about the distinctions between axios and vue-axios. Which one is recommended for use, or do we need to utilize both when using an API? Appreciate any insights! ...

If the option is 'Gel', use an if statement to console log

I'm trying to console.log the option from the data() function that is equal to 'Gel'. I attempted to use an if statement, but it doesn't seem to be working. Anyone have any ideas on how to make this work? data(){ return { ...

The bidirectional data binding feature is malfunctioning following an XMLHttpRequest request

When watching a property from Vuex, I use the following approach: computed: { ticket() { return this.$store.getters['order/reservation'].offer_id } }, watch: { ticket(newTicketId) { console.log('Caught change of ...

Uncovering Inline Styles Infused with Javascript for Effective Debugging of Javascript Code

SITUATION: I have recently inherited a website from the previous developer who has scattered important functions across numerous lengthy JS files. I am struggling to track down the source of an inline CSS style within the JS or identify which function is d ...

Strategically bypassing the third step to directly progress to the fourth step

Here's my code snippet in vue.js where I'm attempting to skip from the third step to the fourth step in a multi-step form. Essentially, if we're on the second step and press the next button, it should directly take us to the fourth step, byp ...

How to change the padding of a parent element in CSS3?

I've created a circle-shaped div element using the following code: #circle{ width: 320px; height: 320px; background-image: url('image.jpg'); border-radius: 50%; background-position: 50% 50%; transition: all 1s; } This circle expands on hov ...

Methods for scaling the size of CSS background images

Can anyone assist me with scaling background image size properly? code: http://codepen.io/AnilSimon123/pen/JRBRZa Below is the code snippet: .bgimage{ background:url('http://www.thedesignlove.com/wp-content/uploads/2012/08/free-blue-abstract-vec ...

Setting up a Contact Email for your Nuxt Static Generated site: A Step-by-Step Guide

I have a website built on Nuxt and hosted on Netlify. I utilized the 'static' method in my nuxt.config.js file to generate the dist folder. My goal is to trigger an email notification whenever a user submits a contact form on my site. It functio ...

Switch the background image of one div when hovering over a different div

Can anyone assist me with creating an interactive map where continents light up as you hover over them? I am using multiple images within div elements in order to achieve this effect. Specifically, I want to change the background image of one div when hove ...

Ensuring the validity of input tags

I encountered an issue with an input tag that has a specific logic: https://codepen.io/ion-ciorba/pen/MWVWpmR In this case, I have a minimum value retrieved from the database (400), and while the logic is sound, the user experience with the component lea ...

Creating a torn paper illusion using CSS masking techniques

My goal is to create a ripped/lined paper effect using CSS mask. It's working well and looks good. However, I'm struggling to apply the mask at the top as well. Here's what I've tried so far: mask-image: linear-gradient(white, white), u ...

When the open button is clicked, the Div will toggle between open and closed states

Recently, some of my questions have not been well-received, which makes me feel a bit disheartened. It's important to remember to be kind when providing feedback. I've noticed that some people downvote without offering constructive criticism, whi ...

JavaScript - Reveal a div when a grid item is clicked

I have created a grid with a 5x7 layout using divs. I am trying to achieve a feature similar to the Netflix interface where, upon clicking on a div, a larger div will appear beneath it. This larger div should expand to 100% width of the parent container, p ...

What is the recommended lifecycle hook in Vue.js2 to execute a function when the page is loaded?

I have a dynamic table that can be filled with various numbers of rows, and I want to add an overlay before the data is loaded using my applyOverlay() function. Below is the structure of my HTML: <table id="table" class="datatable" s ...

HTML5 Division Element Dimensions

I am currently modifying an HTML5 template. The default Bootstrap parameters were set as: col-sm-12 col-md-4 col-lg-4 col-sm-12 col-md-8 col-lg-8 This configuration allotted 20% of the screen width to text and 80% to images, but I want it reversed. Tex ...

Altering the dimensions of radio buttons

I am a newcomer to using material-ui. I am currently working on incorporating radio buttons in a component and would like to reduce its size. While inspecting it in Chrome, I was able to adjust the width of the svg icon (1em). However, I am unsure how to a ...

Why is a div nested inside an overflow: hidden; div not expanding to the full width of its content?

.container { white-space: nowrap; overflow: hidden; } .inner { width: 100%; } .list-item { display: 'inline-block', boxSizing: 'border-box', border: '3px solid black' } import React, { Component } from 're ...

Establish the height of the root to be the same as the height

As a newcomer to HTML and CSS, I am struggling with setting the background color of my root div on a webpage. My code is quite complex, but let me simplify the issue for you by providing a sample problem below. <style> #background{ background-c ...

Using a Vue component to send a form for submitting data into the backend database of a Django application

Where should the connection between a form within a Vue component and a Django backend be established? In my frontend, I am utilizing VueJS where my primary component can retrieve data from a JSON file through an API specified in my Django view and URL fi ...

Incorporate a dynamic avatar into your Navbar with the help of Bootstrap-Vue

I have integrated the Navbar component with Boostrap-Vue and am trying to include an avatar, where the image comes from a variable in the application. The issue I am facing is that I am unable to bind the variable to the avatar component within a slot, as ...