Git Product home page Git Product logo

Comments (3)

joshuamorony avatar joshuamorony commented on May 27, 2024 1

Just FYI: the mutation observer shenanigans I use is no longer required. In the version of Ionic I used for the tutorial you had to wait for the ion-scroll element to be added and then listen for scroll events on that, but now you can just listen for scroll events directly on ion-content.

from fluster-app.

peterpeterparker avatar peterpeterparker commented on May 27, 2024

@joshuamorony thx 👍 I use a listener in my directive (@HostListener('ionScroll', ['$event'])), I should check if that works the same, I guess so, it works fine on iOS

also I'm interested to try how you manipulate the css (initStyles()/hide()/show()) which might be smoother than manipulating only webkitTransform

Hopefully one of these will allow me to unleash the effect on Android too...

from fluster-app.

peterpeterparker avatar peterpeterparker commented on May 27, 2024

@joshuamorony look like we are actually a complementary team ;)

the way I implemented my parallax effect was good on iOS but glitchy on Android. yours is the contrary, works like a charm on Android but turned out (didn't analyzed it much) to be glitchy when I tested it on my real iPhone 6s/iOS 12

so I just decided to handle both cases in a single directive, thx a lot for the tutorial which allowed me to unleash the effect on Android too 👍

btw. regarding the tutorial, just in case, I had to do the following improvements:

  • I removed the modification of the opacity because there is a box-shadow on the parent element (ion-header) on Android which gonna remains sharp while scrolling and hiding the toolbar

  • The toolbar height might not be 44px, per default I think it's 56px now on Android, therefore I read and apply the actual value with a variable in the directive

  • I only apply the "transition" styles once

  • And finally the most important, before anything, the toolbar height should be actually added as attribute "height" to the toolbar otherwise the very first time we will scroll and trigger the parallax effect, there would be not transition on the height aka the height would be directly set to 0px without any transition

all together the directive looks like the following: https://github.com/fluster/fluster-app/blob/master/src/app/directives/core/navbar/navbar-on-scroll.directive.ts

from fluster-app.

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.