Using JavaScript to animate scrolling once the 'mouseup' event has occurred

My current project involves creating a sliding effect with smooth scrolling using CSS, but I've encountered an issue when the 'mouseup' event triggers. The scroll-behavior: smooth; animation that I implemented doesn't behave as expected. I tried adding transitions in my React code to address the problem, but it didn't work.

The desired outcome is for the panel to smoothly animated scroll while dragging the cursor. However, what actually happens is that upon releasing the cursor, the scroll animates rapidly instead of smoothly. I hope this explanation clarifies the issue.

Visit this link for more details

Answer №1

Your objective may be a bit unclear and the explanation provided is somewhat challenging to follow. However, if your main aim is to create a slider or carousel, there's no need to reinvent the wheel. A simpler solution would be to utilize SwiperJS.

I've been using SwiperJS for some time now, and I can confidently say that it is the best slider/carousel tool I have come across.

It is easy to set up, offers great examples, and is compatible with vanilaJS, React/Next, Angular, Vue, among others.

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

Configuring a router for various roles in Meteor Js

Seeking assistance in setting up router for various roles. Here's the code snippet I am working with. Would appreciate any guidance. if (Roles.userIsInRole(['admin'])) { Router.go('/addItem'); } else { Roles.userIsInRole([ ...

JavaScript function trying to send a POST request to API

I'm encountering an issue when attempting to execute an API GET request using JavaScript's built-in XMLHttpRequest function. I'm perplexed by why this functionality is failing to operate properly. function getStats(username){ const request ...

The iisnode module is having difficulty in initializing the node.exe process

My iisnode module is having trouble starting the node.exe process. I need to ensure that the node.exe executable is located where it should be according to the system.webServer/iisnode/@nodeProcessCommandLine element in the web.config file. Typically, node ...

Silhouette as the backdrop image

There is a span element that I am using in the following way - <span class="tick"></span> This creates a decorative "tick" for a checkbox. The CSS code used for this is - input[type="checkbox"] + span > span.tick { display: block; ...

Select various icons within a div that already has a click event attached to it

Having an issue with a clickable div element. Working on an Ionic 2 audio application where I have a series of divs each containing different icons. Specifically, each div has two icons - one for downloading the audio and the other for playing it. I wan ...

Tips for using the POST method in ReactJS

As a newcomer to ReactJs, I am currently working on creating a CRUD application using ASP.net and Reactjs. I have successfully displayed the table and now I am looking to insert values into the table from forms. Can someone please guide me on how to accomp ...

Postal Code Auto-Suggest by Google

I'm attempting to create a unique autocomplete feature for a text box that specifically provides postal codes. To accomplish this, I have followed the guidelines outlined in the documentation found at https://developers.google.com/places/webservice/au ...

I struggle with managing a z-index in conjunction with an absolute position

Check out this codesandbox to see the issue where the 3 dots button is displayed over the menu. Click on the 3 dots to understand the problem. Below is the CSS code for the menu: .more-menu { position: absolute; top: 100%; z-index: 900; float: l ...

What is the best method to ensure a TALL table header is repeated on every page in Chrome?

First time poster =) I am currently facing an issue while trying to print a long table and have the table header repeat on each page. The problem arises when the height of the <thead> reaches a certain threshold, specifically 242px in Chrome 87.0.42 ...

A guide to changing the height of a column in Bootstrap

I've utilized Bootstrap to create features in the HTML, and I'm attempting to make each box's height consistent. Check out a screenshot of the boxes here #hr-1 { width: 100px; margin-left: 20%; } #features { background-color: #f0 ...

Can you explain the distinction between "next": "12.2.5" and ^12.2.5?

While working on my NextJS project, I encountered an error message from Vercel: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inc ...

Filtering by ingredients in React: A step-by-step guide

Currently, I am facing an issue with filtering recipes based on ingredients. When I try to select multiple ingredients using checkboxes, my recipes disappear because the search field receives "ingredient1, ingredient2" as a single string instead of separat ...

How can I prevent a child div from activating the hover effect on its parent div?

I am currently exploring how to create a child element with position: absolute that is placed outside of its parent element without triggering the parent's :hover effect. Despite the parent having a hover effect, the child elements will still activat ...

A New Approach to Fetching Data in Next.js 13.2 using Sanity

Simply put, the main issue revolves around my usage of Sanity as I delve into learning it. While referencing their documentation at , they make use of getStaticProps. Unfortunately, with my utilization of Next.js 13.2 experimental app directory, this speci ...

Script on the server side using Node.JS to make updates to a JSON file

I'm in the process of developing a NODE.JS file to update a JSON file with data coming from the client. The POST method is functioning correctly, but I am facing issues with the GET command. I was thinking about alternative approaches to tackle this i ...

Is there a way to ensure that the cards remain securely within the confines of the background image at

Struggling to keep the cards neatly contained within the background image regardless of screen size. Here's my code snippet: {% block content %} <style> .custom-skills-section { background: url('{{ background_image ...

Guide to autonomously scrolling exclusively within the <div> element in Vue.js

I am currently developing a frontend application using Vue 2. Within the application, I have implemented a chat feature and enabled auto-scroll to the end of the chat on update(). An issue has arisen where the scroll action affects not only the chat box ...

Angular directive compatibility with Mozilla Firefox

I've encountered a strange issue with my directive in Firefox. The directive is designed to limit user input, and it functions correctly in Chrome. However, in Firefox, once the user reaches the input limit, they are unable to delete any characters - ...

Dynamic menu causing interference with other elements of the code

When the width reaches a maximum of 37.em, the navigation styled under a hamburger menu automatically opens. I would prefer it to remain closed rather than open when scaled to that size. It also allows the underlying menu underneath it (div.gallery with cl ...

CSS - revealing additional submenu on hover

I'm currently working on customizing a Wordpress menu that includes classic menu items and their respective submenus. The issue I'm facing is that when I hover over an item with children, its submenu will display. However, I want to have a fixed ...