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

how to target the last child element using CSS commands

<a><div class="myDiv"></div></a> <a><div class="myDiv"></div></a> <a><div class="myDiv"></div></a> <a><div class="myDiv"></div></a> // This specific one is what ...

Unable to pinpoint the source of the excess spacing within a form field

There appears to be some extra space in the text field of my form, extending beyond the container margin. Please refer to the image and JSFiddle http://jsfiddle.net/GRFX4/. Any thoughts on what might be causing this issue? Thank you. HTML: <div id="co ...

integrating the WordPress header into the WHMCS client portal

While working on a project, I am facing the challenge of aligning the WHMCS client area with my WordPress site. Progress has been made, but I have hit a roadblock. My goal is to integrate the header of my WordPress site into WHMCS. I initially attempted t ...

Retrieve data from a MySQL database using PHP to populate a set of dynamic input fields that allow users to add or

Currently, I am facing an issue with fetching values from a MySQL database to dynamically add and remove input table fields on my edit.php page. While I am able to successfully fetch all the values, the automatic calculation feature is not functioning as e ...

Vertically center the container

I am struggling to center my container div vertically, similar to how it is horizontally aligning with margin: auto;. Despite searching online for solutions, I have not been successful in finding a method that works for me. It is surprising to me that in t ...

Seamlessly connect Gridsome with HubSpot for advanced page tracking

As a novice developer who has recently taken on clients, I encountered a request to integrate a website with the HubSpot page tracker. After checking the developer page, I realized that there are no specific instructions for Gridsome, which is what my app ...

Implementing the sticky positioning property to keep a div container fixed at the bottom of the page

As Bootstrap 4 no longer supports .affix, I had to look for an alternative solution to keep a box fixed. I needed a div container to remain fixed as you scroll to it. My current workaround is using: .fixedcard{ position: sticky; top:75%; } However, th ...

Integrate yaml-loader into the i18n settings of a Vue-CLI 3 project

After diving into the Vue-i18n library and exploring this tutorial, I successfully incorporated tags in json format within my project created with vue-cli. While browsing through the documentation, I noticed an example using yaml instead of json. However ...

Tips for automatically resizing a canvas to fit the content within a scrollable container?

I have integrated PDF JS into my Vue3 project to overlay a <canvas id="draw_canvas"> on the rendered pdf document. This allows me to draw rectangles programmatically over the pdf, serving as markers for specific areas. The rendering proces ...

The top navbar does not stay fixed when the page is scrolled

Having some trouble with my navbar. Here is the code I'm using: <nav id="strumenti" class="navbar navbar-expand-sm navbar-light bg-light sticky"> <a class="navbar-brand" href="#"> <img src="C:\Users\Fabry\De ...

How can we have a div stay at the top of the screen when scrolling down, but return to its original position when scrolling back up?

By utilizing this code, a div with position: absolute (top: 46px) on a page will become fixed to the top of the page (top: 0px) once the user scrolls to a certain point (the distance from the div to the top of the page). $(window).scroll(function (e) { ...

Show various Bootstrap Alert Messages based on the type of error detected?

Trying to figure out how best to explain this, here it goes! I am working on a website and I want to incorporate alert messages. Check out some examples here. Depending on the form inputs, I need different alerts to be displayed. PHP will validate the in ...

Add a background image to the parent element while preserving the existing background color

Can you help me figure out how to apply a background image to the menu while still keeping the background color? HTML: <div class="top"> <div class="menu"> Nop. </div> Nam hendrerit erat eget tellus mollis facilisis. ...

Learn the steps to update PHP headers on a specific website using AJAX

contactfrm.php <?php // Server side validation $name = $_POST['name']; $surname = $_POST['surname']; $bsubject = $_POST['subject']; $email= $_POST['email']; $message= $_POST['message']; $to = " ...

Creating a dynamic template in a single file component with Vue.js 2

I've been looking for a way to have a single file component load its template via AJAX. After doing some research, I stumbled upon the concept of dynamic components. To achieve this, I created a parent component that imports a child component and rend ...

What is the best way to eliminate all borders from a select box?

Is there a way to completely remove all borders from the selectbox using either CSS or JQuery? The code snippet is as follows: <select id="doctor_ch"> <option value="1" selected>One</option> <option value="2">Two</option& ...

How to update the border color of focused elements in ExtJS?

In my ExtJS application running on ExtJS 6 with the default Theme-Triton, I am looking to customize the focus border color. Is there a solution to modify the CSS property that will globally change the focus border color from blue to red, for instance? ...

Implement Vue JS to set default value(s) in an array

While browsing through Stack Overflow, I've noticed many questions related to Vue JS and selecting a default single value from an Array. My situation is a bit different - I need to compare each item's array groups with an array containing ALL THE ...

What steps can be taken to turn off specific warning rules for CSS mode in ACE editor?

Utilizing the Ace Editor (through Brace and React-Ace) is a key aspect of my project. In our implementation, we specify the editor's mode as "css" and integrate it into our webpage. While this setup functions correctly, we have observed that some of ...

Attempting to access the second "th" element within a table by utilizing Vue 3 template within Cypress

While conducting my cypress test, I am attempting to access the second element in a table from the Vue template: <template> <table id="table" class="table" data-cy="table"> <thead class="table-head&qu ...