Bug with FullPage scrollOverflow sections when scrolling with iScroll's scrollTo() function

I've encountered an issue while using FullPage with scrollOverflow: true. I need to scroll to a specific position in a scrollable section. The problem arises from the fact that FullPage utilizes a modified version of the iScroll plugin for these overflow sections.

My current approach involves:

  • Triggering FullPage scroll to the desired section
  • Finding the instance of iScroll within that section and triggering its scrollTo() event
  • Rebuilding FullPage

Although the scroll positions of both plugins adjust correctly, there seems to be a glitch where FullPage fails to recognize iScroll's scrollTo() event. As a result, it behaves as if the active section is scrolled to the top, causing scrolling up to go to the previous section and scrolling down to move below the content unexpectedly.

document.querySelector('.button').addEventListener('click', e => {
  fullpage_api.moveTo(3)
  fullpage_api.getActiveSection().item.querySelector('.fp-scrollable').scrollTo(0, 1000, 1000)
  fullpage_api.reBuild()
})

To demonstrate the bug, here is a simplified version of my code: https://jsfiddle.net/5bojtrmd/13/

After clicking the button, you won't be able to reach the title of section 3 anymore, and you can scroll into a red zone that shouldn't be visible.

Answer â„–1

Just a few important notes:

  • Remember to use a negative value for the `iscroll scrollTo` y position.
  • Ensure you are calling the refresh function of iScroll, not fullPage.js.

Check out the code snippet below:

document.querySelector('.button').addEventListener('click', e => {
    fullpage_api.moveTo(3)

    var instance = fullpage_api.getActiveSection().item.querySelector('.fp-scrollable').fp_iscrollInstance;
    instance.scrollTo(0, -1050, 1000);
     setTimeout(function () {
        instance.refresh();
    }, 1000 + 150);
});

View demo online.

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

Incorporate the ng2-ace library into a newly generated Angular-CLI (Angular2) project with the help of SystemJS

After setting up my angular2 project using the latest angular-cli tool, I decided to integrate the ace editor with the help of the ng2-ace library. My goal was to implement this in a clean manner using SystemJS as the module loader. I started by running ...

Perform a calculation using data from one schema and store the result in a different schema within MongoDB using Node.js

var ItemSchema = new Schema({ name: {type: String}, size : {type: String}, price : { type: Number} }); var SizeSchema = new Schema({ sizeName: {type: String}, dimensions : {type: String} }); F ...

Error encountered: The property indexOf cannot be read. Possible issue with .load() function in jQuery causing this error

https://i.sstatic.net/R7zUX.png As I navigate through the page and interact with different elements, I encounter an error message. The Obj function, which is responsible for setting a property value in an object from a handlebars template input and loadi ...

Dividing JSON information into parts

I am attempting to present a highchart. I have utilized the following link: Highchart Demo Link Now, I am trying this web method: [WebMethod] public static string select() { SMSEntities d = new SMSEntities(); List<str ...

Attempting to create an array using jQuery's :checked selector

In my table structure below, I have multiple rows with various data: <tr class="row"> <td class="row-checkbox-delete-row"> <input tabindex="-1" class="checkbox-delete-row" type="checkbox" /> </td> <td class="r ...

Using an array.map inside a stateless component with React.createElement: the type provided is invalid

There is a component called BasicDetail in my code with the following structure: import React from "react"; import { Grid, Form } from "semantic-ui-react"; const BasicDetail = ({DetailData}) => { return( <div> <Grid.Ro ...

The attribute 'split' is not found on the never data type

I have a function that can update a variable called `result`. If `result` is not a string, the function will stop. However, if it is a string, I then apply the `split()` method to the `result` string. This function always runs successfully without crashin ...

Solving compatibility problems with jquery AJAX requests on multiple browsers

searchCompanyExecutives: function(criteria, callback) { var params = $j.extend({ type: "GET", data: criteria, url: "/wa/rs/company_executives?random=" + Math.floor(Math.random() * (new Date()).getTime() + 1), ...

What could be the reason for my Angular component not updating its value?

component1.html : <div class="nums-display"> {{nums}} </div> TS: nums: Array<number> = [0, 1, 2, 3]; ngOnInit(): void { this.numService.getNum().subscribe((res) => { this.num = res; }); } component2.html: <div (cli ...

Draggable resizing of the Accordion component in React.js using Material-UI

In the visual representation, there are two Accordions—one positioned on the left (30%) and the other on the right (70%). Upon clicking the button, the right accordion disappears, while the one on the left expands to cover the full width (100%). A featu ...

Transferring class titles between div elements

I would like to implement a feature where class names on div elements shift after a brief delay, perhaps 10 seconds. My goal is for the 3 classes listed below to cycle through the div elements and start over once it reaches the last one. For instance: & ...

"Navigate back to a previous page in Vue Router without having to

I am currently exploring the option of creating a back button in my Vue.js application using vue-router that mimics the behavior of the browser's native back button. The challenge I'm facing is that when using history mode for the router and tryi ...

I'm looking to fill multiple input boxes with the same value

I am looking to pass the same value to multiple input boxes. Currently, the script below only displays in one box but I want to display the main box result in all multiple input boxes. <script type='text/javascript' src='http://code.jque ...

Utilizing Vue JS to showcase a pop-up block when hovering over a specific image

There are four images displayed, and when you hover over each one, different content appears. For example, hovering over the first image reveals a green block, while hovering over the second image reveals a blue block. However, the current logic in place i ...

The JavaScript class failed to work properly within the asp.net framework

I have successfully implemented a JavaScript function on my aspx page. Here is the code snippet: <script type="text/javascript"> $(document).ready(function () { console.log("ready!"); var options = []; var ...

Is it possible to include parameters within a print() function in JavaScript?

Can anyone help me figure out how to add parameters to a print function? I only want to print a specific table, but when I try to print it, the entire page gets printed instead. Here's my code: let tableContent = document.getElementById('tablen ...

What are the issues with the latest API routing in Next.js?

I am encountering an error that says: SyntaxError: Unexpected token s in JSON at position 0 Here is my code: import { PrismaClient } from '@prisma/client'; import { IDPay } from 'idpay'; import { NextResponse } from 'next/server&ap ...

Error: Module 'fs' does not export the function 'existsSync' as requested

When I simulate the behavior of the fs module jest.mock('fs', () => { return { default: { readFileSync: () => { return CONTENT_DATA; }, existsSync: () => {}, }, }; }); Then I attempt to dynamically ...

Unexpected interactions between Socket.io and React using hooks

Currently, I am delving into the world of Socket.io with React utilizing Hooks. My goal is to create a timer that starts upon pressing the start button, and then every second, send the current time in the state to the server using socket.io. The server co ...

"Utilizing VueJS XHR functionality within a versatile and reusable component

Seeking advice on best practices for improving the following scenario: I have a single global reusable component called <MainMenu>. Within this component, I am making an XHR request to fetch menu items. If I place <MainMenu> in both the heade ...