Code Monkey home page Code Monkey logo

Comments (4)

ncaroyannis avatar ncaroyannis commented on May 25, 2024 3

This is super late, but here's a solution in case anyone is looking for this specific functionality:

CSS:

.section {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.3s;

    &.selected {
        opacity: 1;
    }
}

JS:

$(function() {
        $.scrollify({
            section: ".section",
            scrollbars: false,

            before: function(index)
            {
                items = $('.section');
                item = $($('.section').get(index));

                items.removeClass('selected');
                item.addClass('selected');
            },
       });
    });

from scrollify.

lukehaas avatar lukehaas commented on May 25, 2024

Do you mean adding fade-in,fade-out on the page section? As that currently isn't possible, that would require the page sections to be layered on top of each other rather than stacked linearly as they currently are.

The before and after methods are called before and after the scroll transition respectively.

from scrollify.

fnbns avatar fnbns commented on May 25, 2024

Hey man, thanks for the answer. Can you give me an example? I was thinking to hide the next section on before and on after to show it with a fade-in, do you think this might work ?

from scrollify.

lukehaas avatar lukehaas commented on May 25, 2024

You're probably better off creating a wrapper for your content within the sections and fading them in/out rather than fading the sections in/out. If you're using jquery fade methods then I think fading out will end with applying a display:none to the element, which, if applied to a section, would change the position of all sections as a result. This would mess things up for scrollify.

Regarding before/after.
Within the after, for example, the method receives the current section index and an array of all sections so you can use that to find the content of the section and apply your animations etc to it.
I suggest adding console.log(arguments); to your after method to get a better idea of how what you have access to here.

from scrollify.

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.