Giter Club home page Giter Club logo

Comments (3)

janpaepke avatar janpaepke commented on August 26, 2024

Hi Cezar,

yes they can, but with some limitations.
They can only be pinned directly if they have no set value for their top position. It's a bit complicated to explain but long story short here's how you can make it work:

Either have the positioning set to auto or wrap it inside another div that is positioned auto and pin that. The result should be the same. The outer div can be positioned relative or absolute (with top=auto).

I have a list of examples of the ways elements can be pinned. I will post it in the near future.

I hope that helps.

regards,
Jan

P.S.: Sorry for the late answer, I was on vacation.

from superscrollorama.

damassi avatar damassi commented on August 26, 2024

There actually is a way to do this, but its kinda crazy. (Excuse the pseudocode.)

var controller = $.superscrollorama({
    triggerAtCenter: true,
    playoutAnimations: false,
    reverse: false
});

var pos

// prevent the user from scrolling anywhere
function onScroll() { 
      if( $(document).scrollTop() > pos )
          $(document).scrollTop( pos )
      })
}

var timeline = new TimelineMax()

timeline.append( TweenMax.to( $('#hi', 3, { y: 1000, onComplete: function() {
    // Release the window and continue on
    $(document).off( 'scroll', onScroll )
}}))

controller.pin($('#hi'), 3000, {
    anim: timeline,

   onPin: function() {
        // Store the current window position
        var pos = $(document).scrollTop()

       // Start listening to scroll events
       $(document).on('scroll', onScroll )

        // remove the pin so that it will pick up changes
        controller.removePin( '#plushupper-tagline' )

       // Start listening to mousewheel events
       $(window).bind('mousewheel', function(event) {
         // scrolling up
             if (event.originalEvent.wheelDelta >= 0) {
                 timeline.time( timeline.time() -= .1 )
             }

             // scrolling down
             else {
                  timeline.time( timeline.time() += .1 )
             }
      });
    }
});

from superscrollorama.

janpaepke avatar janpaepke commented on August 26, 2024

Hi damassi,

I think this comment was actually intended for a different question.
I will copy it there.

regards,
Jan

from superscrollorama.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.