Guide on fixing a parent div's position for a specific duration using the scrollorama plugin

Currently, I am utilizing the "scrollorama" plugin to create a parallax effect on my website.

I have a specific requirement where I need to fix the parent div of the animated elements for a certain duration and then release it to allow the next section of code to animate seamlessly....

To better understand my goal, please take a look at this link.

On this particular site, I am aiming to delay the animation of the initial section until the site logo "Prototype" moves up to its designated fixed position. After that, I want the content within the first list item to gradually enter the scene without interference from other sections.

I believe what I'm looking for is known as "pinning," however, I am unsure about how to implement it...

<body>
<a class="fixed" href="prototype.html"><img src="images/logo.png"/></a>
<ul class="curtains">
    <li>
        <div class="cont clearfix">
            <ul>
                <li class="img_1"><img src="images/01.jpg"/></li>
                <li class="img_2"><img src="images/02.jpg"/></li>
                <li class="img_3"><img src="images/03.jpg"/></li>
                <li class="img_4"><img src="images/04.jpg"/></li>
                <li class="img_5"><img src="images/05.jpg"/></li>
                <li class="img_6"><img src="images/06.jpg"/></li>
            </ul>
        </div>
    </li>
</ul>
...

Answer №1

To start, you should first pin the main div and then initiate the animation on its child div.

    controller.pin($('#examples-2'), 3000, {
  anim: (new TimelineLite())
    .append(
      TweenMax.fromTo($('#move-it'), .5, 
        {css:{left: -200, top: 500}, immediateRender:true}, 
        {css:{top: -400}})
    )
    .append(
      TweenMax.to($('#move-it'), .5, 
        {css:{left: 0}})
    )
});

In the above code, examples-2 represents the main div that will be pinned once it reaches the center of the page. The value 3000 indicates the number of pixels for the complete animation to occur. The sub div move-it is where the animation defined in the code will take place. To unpin, use the following code:

controller.removePin('#examples-2', false);

For more information on how to use pin, visit

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

Switching the orientation of an iPhone on Chrome can lead to content being cut off

Currently, I am conducting testing on an iPhone XS running iOS 15.6.1 The website seems to function properly on iOS Safari (although untested on Android), however, a problem arises when using Chrome and rotating the screen from landscape to portrait mode. ...

Is it possible to implement a page transition using preact?

I've been experimenting with creating a page transition using preact-router. I attempted to use the preact-transition-group package along with the preact-css-transition-group package, but encountered an error. Despite this, here is my basic setup: imp ...

Generating fresh instances in for loop - JS

I am working on a page that showcases graphs based on selected criteria. Each graph requires its own object reference, and I am creating new objects within a for loop. However, I'm facing the challenge of accessing those objects outside of that specif ...

Element is not being populated by ajax result instantaneously

Here is a snippet of code that I am struggling with: function fetchVenues(categoryId) { var venues = ""; $.getJSON('@Url.Action("GetVenues", "Team")' + "?categoryId=" + categoryId, function (data) { ...

What do the letters enclosed in brackets signify?

I am currently working with a library known as Monet.js, and within the documentation, there are descriptions that look like this: Maybe[A].map(fn: A => B) : Maybe[B] I am unsure of what the letters inside the brackets stand for. Is there anyone who c ...

Having a flash video load on a new page in the same position as it was on the previous page

On my website, I have a subtle flash video playing in the background that loops every 30 seconds. It's not necessary for navigation, just a nice visual touch. However, every time a new page is loaded, the video restarts from the beginning. I'm l ...

What is the process for retrieving information from a database in Django when the submit button is clicked?

Is there a way to retrieve database objects in HTML only when the submit button is clicked, instead of loading them automatically on page load? Currently, I have an AJAX script running on a form that displays text entered in a textbox onto the HTML when th ...

Challenge with executing javascript library (photo sphere viewer)

I was excited to incorporate Photo Sphere Viewer into my project. After running npm i photo-sphere-viewer I noticed that the modules were successfully downloaded. Following that, I added this line inside my project: import PhotoSphereViewer from ' ...

Verify password input area

I've been attempting to validate the password field before sending the user's details to the server. I tried using jQuery and PHP to achieve this, but unfortunately, I'm struggling to make it work. Despite my efforts, the form is still submi ...

Access data from previous request and transmit it to another request in a Node.js environment

I am facing a situation where I need to extract the parsed json response from a variable in a POST request, store it in a new variable, and then pass that variable in the headers for a subsequent GET request. However, my current approach is not yielding th ...

How to retrieve a Facebook user access token using server-side scripting with Node.js

I am looking to retrieve my Facebook ad campaign statistics every 30 minutes using Nodejs. To accomplish this, I require a user access token that needs to be refreshed for every request due to expiration. Any suggestions on how I can achieve this solely ...

Samsung devices exclusively showcase background in responsive design

I am encountering a major problem with my website design, specifically with its compatibility on mobile devices. To ensure its responsiveness, I have tested the design on my iPhone, iPad, and Windows Phone. Unfortunately, since I lack an Android device, I ...

Is there a standard event triggered upon the closing of a browser tab or window?

Does React have a built-in event that is triggered when a browser tab or window is closed? If it does, does it have support across different browsers? ...

HTML5 body content and footer area

I'm working on a website with the main content area set to 95% width, but I'm facing an issue - I want the footer to be 100% width even though it's a child of the main content, which limits its width. Is there a way to make the footer overr ...

Jquery and adaptability

I currently have a scrollTo anchor link script on my website that has an offset of -35px to account for my 35px high navigation bar. However, I find that this offset may need to be adjusted for different screen resolutions, such as smartphones or tablets ...

assigning a variable using jQuery

<script> function update(elem) { var ele=$(elem).siblings('label#test').html(); var a=document.getElementById('test'); var htm = '<input type="text" name="modal" id="modal" style="width:70%;" value="'+$(elem).siblings ...

Animating objects in three.js along the projection plane

I am looking to implement a feature where objects can be moved along a plane parallel to the projection plane using the mouse. The challenge is to keep the distance between any selected object and the camera's projection plane constant throughout the ...

Adjust the div size to match the content and align it centrally within the parent element using fxLayout

https://i.sstatic.net/FlVv6.png Is there a way to use fxLayout in Angular to achieve the layout shown in the image above? Below is a snippet of my code and an image displaying the output. The red div currently matches the width of the blue div, causing t ...

Endless scrolling with interactive lightbox feature

Hey everyone, I've implemented infiniteajaxscroll to dynamically load my photos on scroll down. However, the issue I'm facing is that the lightbox plugin I'm using doesn't work on the newly loaded pages. Here's my infiniteajaxscro ...

Encountering problems with ajax technology

As a newcomer to Laravel and Ajax, I am facing an issue with displaying the state of the selected country in a dropdown list. Although the data is successfully fetched from Laravel and received through Ajax, I am struggling to dynamically add it to the H ...