Comments (3)
That's an interesting approach, we might have to test that.
However there might be a couple issues with it:
- I'm not sure
translate
would clip correctly the instructions, as the calculated height would be the same. - It would move the body, but not resize it. This might bring additional issues.
We initially went with a position: absolute
element, growing its height and adding padding to the mainElement
. It seemed hacky and not very elegant. @pateketrueke rewrote it so its height would push down the content, and we're using min-height
because in some instances, if you're using flexbox, the height
would not be taken into account. It was weird.
Maybe through the API we can allow the use case when you need to calculate both element's position/height? Or maybe we could try with will-change
?
from pulltorefresh.js.
I'm not sure, but as far as I know, will-change
property only works optimizing properties that already use GPU acceleration. This means that it would have little to no effect to properties such as min-height
.
I think the best approach (which would probably lead to structure break and maybe should be focused for further major versions) would be to wrap the whole app body into an element, and use translate3d
on both the refresh bar and this element wrapper.
Something like:
<div id="refresh-bar"></div>
<div class="body-wrapper">
<!-- the page content -->
</div>
Then the styles would be applied as follow (according to touch-move):
<div id="refresh-bar" style="transform: translate3d(0, 35.6665px, 0)"></div>
<div class="body-wrapper" style="transform: translate3d(0, 35.6665px, 0)">>
<!-- the page content -->
</div>
This would enable pushing the whole page content bellow, but making use of translate3d()
GPU-enabled property.
from pulltorefresh.js.
The thing with modifying the markup is precisely the counter-point of this proyect: other libraries require changing the structure. And that was a no-no in our use case as it can break a lot of things: from CSS selectors to markup/CSS tricks (like the demo's sticky footer with flexbox).
Adding a to the wrapper would break a lot of thing. Even if it doesn't, moving the main element with translate would overlap with other elements that are not inside the wrapper.
The main focus on this library is making a pull to refresh feature as easy and painless as possible, that's why we went with a new element that pushes down the content, but it doesn't require the dev to rewrite the markup.
from pulltorefresh.js.
Related Issues (20)
- Fails in prerendered or serverside rendered app
- Add bounce with momentum scroll to top? HOT 5
- Allow multiple case in shouldPullToRefresh? HOT 1
- Web pages in IOS WebView cannot be scrolled after using this component. HOT 1
- Not working properly on iOS Safari HOT 2
- onReset: TypeError null is not an object (evaluating 'handler.ptrElement.classList') HOT 4
- pull up to refresh HOT 2
- Does not work when body has been changed HOT 3
- PulltoRefresh occasionally breaks click events in iOS Safari HOT 2
- destroyAll does not destroy all thus causing PullToRefresh misbehave when `styleEl` has been removed from DOM
- `handler.destroy()` should remove ptr element immediately
- TypeError: Cannot read properties of null HOT 2
- CSS animation runs whenever the state changes. HOT 1
- Cannot find module 'pulltorefreshjs' or its corresponding type declarations.
- Can I pull up to refresh? HOT 1
- Prevent refresh for overflowing children while !window.scrollY HOT 2
- TypeError: Cannot read properties of null HOT 1
- Troubles styling with CSS HOT 1
- i18n support? HOT 1
- css
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pulltorefresh.js.