Vue Labyrinthine Design theme

Looking for some guidance from experienced developers out there! I'm currently exploring how to incorporate Mazeletter as a background feature for each page in an app project I've been working on.

This is all new territory for me, so any assistance would be greatly appreciated. I have a foundational test component set up that functions as the background, with elements layered over it successfully.

However, I'd like to take this concept a step further by adding more dynamism. I want the text to be dynamic (passed in via props) and for the background to adapt based on the amount of content present on the page – essentially making the entire design more responsive.

Below is the code snippet of the current test component I'm tinkering with:

<template>
  <div id="mz-background">
    <p class="mz-text">ThisIsATestThisIsATestThisIsATestThisIsATest</p>
    <p class="mz-text">ThisIsATestThisIsATestThisIsATestThisIsATest</p>
     ...
  </div>
</template>

<script>
export default {
  name: "UnderworldPattern",
};
</script>

<style scoped>
#mz-background {
  z-index: 0;
  position: fixed;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.mz-text {
   ...
}
</style>

If anyone can offer insights on enhancing the dynamics of this implementation, your expertise would be incredibly valuable to me.

Thank you for taking the time to read through and potentially assist!

Answer №1

Perhaps consider the following approach: Create a long set of characters and apply overflow: hidden; to #mz-background. Set up a listener in the created hook to detect window resizing and execute a method to determine the number of lines based on the font size. Then, loop through the calculated number of lines in the template (a rough solution).

export default {
  name: "UnderworldPattern",
  data() {
    return {
      textToShow: 'ThisIsATestThisIsATestThisIsATestThisIsATestThisIsATestThisIsATestThisIsATestThisIsATest',
      nrOfLines: 0
    }
  },
  methods: {
    getNrOfLines() {
      this.nrOfLines = parseInt(document.documentElement.clientHeight / 90)
    }
  },
  mounted() {
    this.getNrOfLines()
  },
  created() {
    window.addEventListener("resize", this.getNrOfLines);
  },
  unmounted() {
    window.removeEventListener("resize", this.getNrOfLines);
  },
};


#mz-background {
  z-index: 0;
  position: fixed;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.mz-text {
  line-height: 89.5px;
  font-family: "mazeletter-underworld"; // imported in project css
  font-size: 90px;
  z-index: 1;
  color: black;
  user-select: none;
  text-align: left;
  letter-spacing: -0.409091px;
  overflow: hidden;
  margin: 0;
}


<div id="app">
  <template>
    <div id="mz-background">
      <p class="mz-text" v-for="index in nrOfLines" :key="index">{{ textToShow }}</p>
    </div>
  </template>
</div>

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 is the best way to embed an image into HTML code?

I am trying to enhance the appearance of a phone number inside an HTML code that is loaded into a UIWebView by adding a background image. NSString *stringToReplace = [NSString stringWithFormat:@"<a style=\"color:white; background-color:#707070; te ...

Error encountered while validating jQuery word cloud

Can anyone please assist me with validating a jQuery word cloud in HTML5? I'm encountering issues with all of the rel values showing this error message: "Bad value 1 for attribute rel on element a: Not an absolute IRI. The string 1 is not a registere ...

Unusual marker appearing on every page utilizing ionic v1 and angularjs

For some unknown reason, a dot appears at the upper left side of each page in my webapp: https://i.stack.imgur.com/nN61t.png It seems to be an issue with the HTML code. When I run the snippet below, the dot is visible: <ion-view view-title="Send fe ...

Implementing a tooltip popup inside the header cell of the ordering table

Apologies in advance for my lack of experience with coding more complex website features. I'm attempting to incorporate a tooltip popup into one of the header cells to provide additional information to users. While I have all the necessary component ...

retrieve the position of a descendant element in relation to its ancestor element

I'm encountering a challenge while attempting to solve this issue. I have elements representing a child, parent, and grandparent. My goal is to determine the offset position of the child (positioned absolutely) in relation to the grandparent. However, ...

Issue encountered with dynamic localizations in Vue-i18n when fetching from an HTTP request

My goal is to load localization dynamically through an HTTP call rather than packaging it with the application for better management. However, I encountered an issue where the language does not load on initial render but updates properly when changing rout ...

Discover how to reference a ref from a different component in Vue 3

I have multiple components that I utilize in a component named QuickButton.vue: <Tabs> <TabPanels> <TabPanel><EmployeesMainData/></TabPanel> <TabPanel><ContactAddressData/></TabPanel> ...

Encountering 401 unauthorized error in Laravel Passport, Vue.js, and Axios integration

I am fairly new to VueJS and I am trying to retrieve data from a Laravel (passport) API. To do this, I have used npm i axios for making API requests. Below is the script code from my App.vue file: import axios from 'axios'; export default { da ...

Adjust the image size to fit the page according to its height

Having a dilemma here. I have this square image (2048x2048) that I want to set as a background. The tricky part is, I want it to display borders when the page stretches into widescreen mode, but also resize while maintaining its square shape when the page ...

CSS Float behaving unexpectedly

body { margin: 0; font-family: arial; line-height: 16px; } #topbar { background-color: #600c0c; width: 100%; height: 46px; color: white; margin: 0; } .fixedwidth { width: 1050px; margin: 0 auto; } #logodiv { padding-t ...

Organize Radio Selectors

My intention was to align the radio buttons as shown in the image below: https://i.stack.imgur.com/oPTjD.jpg However, the final result looked like this https://i.stack.imgur.com/Mixga.jpg Below is the code for your reference HTML <div class="form ...

Issues with the navigation and logo design in bootstrap mode

1: How can I adjust the size of the logo and name in my Bootstrap navigation? 2: My navigation menu is not showing up correctly. Can anyone help me troubleshoot? Navbar: <nav class="navbar navbar-expand-lg py-4 fig-nav"> <div class=&q ...

Exploring the Methods to Monitor Variables in Framework7 Store

Currently, I am in the process of developing my app and have opted to utilize the new built-in store system instead of relying on Vuex. I have a variable that undergoes frequent changes and previously used the following code when working with Vuex: store.w ...

Tips for enabling users to access certain routes publicly using VueJS Router/SPA

Currently in the process of creating a new web application using VueJS SPA, VueJS Router, and Laravel. Users should have the ability to access pages as guests (non-authenticated) or when logged-in (authenticated)! I've integrated $this->middleware ...

Position fixed iframe neglects right and bottom positioning

Here is the code snippet I am working with: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head></head> <body> <iframe src="htt ...

Building Dynamic Forms with React.js and Bootstrap for Easy Input Field Management

In the process of developing a web application using React.js and react-bootstrap, I encountered an interesting challenge. On one of the form pages, users should be able to input symptoms of an illness they are dealing with. The key functionality required ...

What is the best way to layer multiple navigation menus on top of each other using z-index?

I'm facing a challenge trying to position or overlap two navigation menus in my project. The technologies I am using are Bootstrap, HTML, and CSS. It seems like I might need to utilize the z-index property, but I'm unsure about the exact impleme ...

Show or hide a fixed position div using jQuery when clicked

I am new to jQuery and I am trying to create a "full page menu" on my own. However, I am struggling to hide the menu on the second click. I tried using .toggle() but I found out that it has been deprecated. Can someone assist me with this? Thank you so muc ...

Removing an article from a Vue.js localStorage array using its index position

I am facing an issue while trying to remove an item from localStorage. I have created a table to store all the added items, and I would like to delete a specific article either by its index or ideally by its unique id. Your assistance is greatly apprecia ...

Mobile media queries are ineffective despite implementing the viewport meta tag

I am facing an issue that even though I have tried various solutions, my media queries are not working on mobile devices after adding the viewport meta tag. Can anyone provide insight into why this might be happening? Update: Upon further investigation, I ...