Unable to vertically scroll on a position fixed element

I recently created a unique VueJS component that enables vertical scrolling. Within this component, there are two elements each with a height of 100vh. At the bottom of the component is a fixed position div. Interestingly, when I try to scroll down using my mouse or finger on mobile while positioned on this fixed element, the container does not allow me to scroll down further.

Below is the code snippet for my component:

<template>
  <div class="flex flex-col">
    <div id="weatherIcon" class="flex justify-end relative overflow-hidden h-1/3">
      <img class="absolute cover-enter-active max-h-full" :src="props.weather.cover" alt="Weather cover" />
    </div>
    <div id="texts" class="flex-col flex texts-enter-active pl-5">
      <div id="temperature">
        <p class="font-bold">{{ Math.round(props.temperature) }}°</p>
      </div>
      <div class="flex items-center" id="weatherDescription">
        <img :src="props.weather.icon" alt="Rain" />
        <p class="ml-1 font-light text-base">{{ props.weather.credo }}</p>
      </div>
      <div id="city">
        <p class="font-bold">{{ props.city }}</p>
      </div>
      <div id="cityDescription" class="py-5">
        <p class="font-light pr-5">{{ props.description.length > 150 ? props.description.slice(0, 150) : props.description }}... <a v-if="props.wikiLink" :href="props.wikiLink" class="font-bold" :style="{ color: weather.moreFont }">en savoir plus</a></p>
      </div>
    </div>
    <div ref="swipeElement" id="swipe" class="mt-auto mb-6 fixed bottom-0 w-full">
      <div id="baseSwap" class="flex flex-col font-bold items-center swipe-enter-active w-full">
        <p>Glisser pour voyager</p>
        <img :src="swipe"  alt="Swipe icon" class="swipe opacity-80"/>
      </div>
    </div>
  </div>
</template>

Answer №1

To solve the issue, you can disable pointer events on the fixed position element. This will allow scroll events to reach its parent container. Simply add the following CSS to your fixed position element:

#swipe{
    pointer-events: none;
}

I successfully implemented this solution on your website using Chrome developer tools and it worked perfectly. https://i.stack.imgur.com/ClQAc.png

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

One way to enhance Razor helpers is by integrating parameters into them

Is there a way to create an HTML Helper similar to @Html.TextBoxFor(model => model.signature) that includes a data-id parameter in the generated input, like shown below? <input type="text" name="signature" data-id="No Signature" /> I understand ...

I'm getting an error in Vue Router that says "Cannot read property 'push' of undefined"

I am experiencing an issue with page redirection. Despite ensuring the accuracy of my definitions, I am consistently encountering errors. Can anyone shed light on why this error persists? Your assistance is greatly appreciated in advance; your support mea ...

Ways to conceal a dynamically generated div upon page load?

I am currently facing a scenario where I need to dynamically create a div. My initial approach was to create it on the document ready event, but the requirement is for it to be displayed only upon selection. The problem I am encountering is that the empty ...

The app is opening the index.html file instead of the expected index.jsx file

After creating a page with React.jsx, I encountered an issue where my page was initially opening index.jsx upon running npm start. However, when I deleted and then restored the index.html file to "public", the page started opening index.html instead. This ...

Tips on utilizing innerHTML or innerText to add content to the Evernote editor, a rich text editor

A method authored by Jayant was employed in this particular post how-to-insert-text-into-the-textarea-at-the-current-cursor-position to perform an insertion into the Evernote editor. The Evernote editor being a rich text editor, altering from el.value to ...

Are custom boolean attributes supported in HTML?

When working in HTML5, we have the ability to utilize custom data-* attributes. However, since these are considered attributes, they generally require a string value. Is there a different option within HTML that allows for custom properties, where boolean ...

How can I update two divs simultaneously with just one ajax call?

Is there a way to update 2 divs using only one ajax request? The code for updating through ajax is in ajax-update.php. <?php include("config.inc.php"); include("user.inc.php"); $id = $_GET['id']; $item = New item($id); $result = $item->it ...

Can input be styled instead of using a textarea for design?

Within the confines of a PDF's single-line display, I am in need of including text that does not contain new lines. While using an input instead of a textarea seems like the ideal choice, inputs do not naturally support line breaks and utilizing keydo ...

The code written inside the <script> tag seems to be malfunctioning when placed in the component.html file within VScode while working with

I'm facing an issue where the script tag for jQuery included in index.html is not being executed within the component.html. There are no errors detected when inspected. Additionally, I have used another script for a toast message box. <script sr ...

Expand the image to fill the entirety of the viewing area

Check out my development website. Whenever you click on an image, a photo slider (using photoswipe) pops up. Is there any way to have the image fill the entire viewport? I attempted using height: 100vh, width: auto, but it didn't work. ...

Customizing PrimeReact Styles

I've been on a quest to find the perfect solution for customizing the default 'Nova' theme used in Prime React. While I know there is a theme designer available for purchase, I'd prefer not to go that route. In the past, I found myself ...

Converting Variable Values to Element IDs in JavaScript: A Helpful Guide

Is it possible to declare a value in variable A and then access that value as an id in variable B using the method getElementById()? var A = 10; var B = document.getElementById(A); console.log(B); ...

Applying a CSS class to multiple instances of a control in ASP.NET

Incorporating the jQuery UI framework into my ASP.NET project is a current challenge I am facing. My approach involves applying CSS to the controls in order to achieve this objective. Specifically, I have multiple GridView controls that need styling. Is t ...

Utilizing data attributes for storing and selecting dual prices on an option

I need help creating a form with options that have two potential values. The user will first choose between "Low Price" (lp) or "High Price" (hp), and then select either Type 1 or Type 2, both of which have data attributes for "hp" and "lp". My goal is to ...

Incorporating a CNAME into Your Vue.js Project

I've been working on a Vue.js project using the vue cli tool and I wanted to add a CNAME file to deploy it in the root folder. The project is hosted on gh-pages, but I've been struggling to include the CNAME file correctly in my gh-pages branch. ...

What is preventing my CSS Animation from activating on my website?

Is there something in the code preventing the animation from working properly? .projectLinks a{ background-color: var(--secondary-color); color: var(--main-color); padding: 2px 4px 4px 4px; border-radius: 15px; margin-right: 25px; text-decorati ...

Adjust font size using jQuery

Hey there! I have a small question. I want to resize all HTML elements using jQuery, but the current code allows me to increase and decrease the size infinitely. var originalSize = $('html').css('font-size'); // Reset ...

Tips for displaying an HTML page using JavaScript

In my project, I am working with an .html file (File X) that needs to immediately open another .html file (File Y) based on a certain value. Could someone provide guidance on the best way to achieve this using JavaScript? Additionally, I would like the pa ...

Troubleshooting Vue 3 Composition API: Issue with Data Access in V-For Loop

Currently facing an issue with a template I have The problem lies with location.drawnfeatures not updating within the template for unknown reasons. I've verified that the data is correct using console.log, and when I tested the code without 'v-f ...

Overriding the w-4xl with sm:text-2xl in Tailwind CSS

Struggling to achieve responsive design on my Pages, especially with changing text size when the screen is small. I've been following all the correct steps and maintaining the right order. However, whenever I set 'sm', it seems to override a ...